File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes java.lang.IllegalAccessError: tried to access field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "java.lang.IllegalAccessError: tried to access field" Watch "java.lang.IllegalAccessError: tried to access field" New topic

java.lang.IllegalAccessError: tried to access field

olze oli
Ranch Hand

Joined: Jun 20, 2009
Posts: 149

i have a little application which uses htmlunit.
but htmlunit is extremly slow so i thought i download the source, change the code in htmlunit where the httpclient is created and use it in my app (i know that the httpclient is much faster sending POST than the htmlunit, but htmlunit has js support, thats the reason why i use htmlunit and not only httpclient)
the httpclient is in a file called
private AbstractHttpClient httpClient_;

so i thought i change it to public, and access it:
response = conn.httpClient_.execute(httppost);

but now i get an error:
Exception in thread "Thread-3" java.lang.IllegalAccessError: tried to access field com.gargoylesoftware.htmlunit.HttpWebConnection.httpClient_ from class Groove.Client
at Groove.Client.sendRequest(
at Groove.Client.getShort(
at Groove.Client.connect(
at Groove.Client.getInstance(
at Groove.browser.GrooveView$

what does that mean?
i also tried it with a getter method but i get the same error
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1789

Seems to me this might be too difficult for a beginner forum. Let's see if you get more responses in the general forum...

When you do things right, people won't be sure you've done anything at all.
Poobhathy Kannan
Ranch Hand

Joined: May 26, 2004
Posts: 94
What i can think of is jar file or the classes loaded at runtime. It may still refer to the old classes. As you have changed the code, please check whether only the modified classes are loaded at runtime
olze oli
Ranch Hand

Joined: Jun 20, 2009
Posts: 149
thanks alot! you have been right, i forgot to delete the .jar
its working now, thanks
I agree. Here's the link:
subject: java.lang.IllegalAccessError: tried to access field
It's not a secret anymore!