You need to sign in to do that
Don't have an account?
agni.fire
compile error - packages vs classes
Hello,
I am new to Apex programming. I am having some trouble getting some apex code running.
Environment;
Eclipse 3.3
Apex Toolkit : 8.0.2002
Apex version on my dev account : 8
Salesforce.com instance : NA3
I have been looking at some of the examples available through the reference manual. I can get the triggers and the S-controls to work. I can't get any of the samples involving class declaration to work. I get compile errors. This simple example doesn't work when I compile in eclipse. I created New Apex Package.
I removed the default automatic code ,
package test{
}
and replaced with .
// This class updated the Hello field on account records that are
// passed to it.
public class MyHelloWorld {
public static void addHelloWorld(Account[] accs)
{
for (Account a:accs)
{
if (a.Hello__c != 'World')
{
a.Hello__c = 'World';
}
}
}
}
I have tried to build this on salesforce.com apex editor and get the error
Error: Compile Error: expecting "package", found 'public' at line 3 column 1
Can anyone tell me if I have an older version of the apex version that uses the older style ( uses packages??, instead of classes) or what I need to do to get these examples working?
Thanks. Your time is appreciated.
I am new to Apex programming. I am having some trouble getting some apex code running.
Environment;
Eclipse 3.3
Apex Toolkit : 8.0.2002
Apex version on my dev account : 8
Salesforce.com instance : NA3
I have been looking at some of the examples available through the reference manual. I can get the triggers and the S-controls to work. I can't get any of the samples involving class declaration to work. I get compile errors. This simple example doesn't work when I compile in eclipse. I created New Apex Package.
I removed the default automatic code ,
package test{
}
and replaced with .
// This class updated the Hello field on account records that are
// passed to it.
public class MyHelloWorld {
public static void addHelloWorld(Account[] accs)
{
for (Account a:accs)
{
if (a.Hello__c != 'World')
{
a.Hello__c = 'World';
}
}
}
}
I have tried to build this on salesforce.com apex editor and get the error
Error: Compile Error: expecting "package", found 'public' at line 3 column 1
Can anyone tell me if I have an older version of the apex version that uses the older style ( uses packages??, instead of classes) or what I need to do to get these examples working?
Thanks. Your time is appreciated.
we will release the updated Eclipse toolkit version on 8/15
until then use the App , under setup->build->code
on the other hand if you create a new class in the app, it will have an API version of 10.0 and then you can't edit it in eclipse.
or am i over-simplifying the compatibility issue?
Thanks to everyone for the quick and helpful response,
Ron, I used the app ( pasted the code into the UI) to compile the code and i still got the error
Error: Compile Error: expecting "package", found 'public' at line 3 column 1
As Simon says, maybe my instance isn't ready yet. I don't mind waiting another week for version 10 toolkit or the app upgrade.
Thanks
agni.fire