function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MSchumacherMSchumacher 

java.lang.IllegalAccessError

When I use the Eclipse workbench and run my java application, I can log in to Salesforce.com, query records and update the records.

When I attempt to execute my java application at the DOS prompt, I receive the following:

Exception in thread "main" java.lang.IllegalAccessError: tried to access field c
om.sforce.soap.enterprise.QueryResult.records from class com.weiler.UpdateFrontE
ndTest.UpdateFrontEndTest
        at com.weiler.UpdateFrontEndTest.UpdateFrontEndTest.VerifyAccount(Update
FrontEndTest.java:184)
        at com.weiler.UpdateFrontEndTest.UpdateFrontEndTest.<init>(UpdateFrontEn
dTest.java:92)
        at com.weiler.UpdateFrontEndTest.UpdateFrontEndTest.main(UpdateFrontEndT
est.java:73)

I am using Eclipse 3.0.1.  My java environment is - java version "1.4.2_04".

I noticed that when I create a new java project in Eclipse and I add the com.sforce.soap.enterprise package, to compile my application, I have to change the QueryResult.java to public.

The line that Eclipse is forcing me to change from private to public is:

   public com.sforce.soap.enterprise.sobject.SObject[] records;

Any ideas is appreciated.

 

Thanks

Mike Schumacher

SuperfellSuperfell
you should be using the generated getRecords method instead of changing the visibility of the records field.
MSchumacherMSchumacher

Simon,

Thanks.   I change the 'if' test back to   if (qr != null).   My application now works in Eclipse and in my command window.

I checked the quickstart.java and the example it used was if (qr != null).  I have to guess that while I was learning my way around Java and the salesforce.com APIs, I made a change and then never got back to testing it in the command window.

Thanks for the quick turnaround on the answer.

Mike Schumacher