IllegalAccessError

I had a jar-ed project before. It has jFreeChart jar as library inside. Everything did run fine.

Then I added more library called jFuzzyLogic. This library has its own jFreeChart jar inside it (inside jFuzzyLogic jar) so I believe it uses its own rather mine. Its and mine jFreeChart jar have different version, mine is newer.

Everything is fine on Eclipse. Then I packaged them again and deploy, I got this

java.lang.IllegalAccessError: tried to access method org.jfree.data.general.Series.<init>(Ljava/lang/Comparable;)V from class org.myName.agent.gui.GuiForAgent

My google-fu said it’s caused by wrong version of library that you use, somekind like version overlapping or what.

So any has solution?

The constructor I see is protected, maybe that changed so you could use it before.

What constructor? ???

Of class Series. I use jFreeChart 1.0.14. There it is protected.
But as I see now it is also abstract, so you can’t use it anyway. Which version do you use ?

Exactly same with you. Exception throwed when instancing TimeSeries.

Then try to kick out the chart stuff from the fuzzy lib.
Bundling/nesting external libraries ain’t no good anyway.

Hmm I deleted chart lib from fuzzy lib, still same.

Delete your own newer version of jFreeChart because jFuzzyLib compiled against the older version.

Replace new one with old one? seems legit. I’ll try it now.

EDIT: It doesn’t work, I got exactly same errors. This is going to be really big problem, as I have to submit this project packaged.

Did you modify the jFuzzyLib jar that included both it and the jFreeChart libs?

My project jar has jFuzzyLib and jFreeChart v14. The jFuzzyLib itself has jFreeChart v11 inside it.

I removed my jFreeChart v14 and replace it with jFreeChart v11, which I got by extracting from jFuzzyLib.

To help anyone that want to help, here is my jars tree.

MyLonelyProject
  |                |
  V               V

jFreeChart14 jFuzzy
|
V
jFreeChart11

OMG! OMG! OMG! OMG! OMG! OMG! OMG! OMG! I solved this by only change export order in eclipse, even though it resulted to force me using old lib one OMG! OMG! OMG! OMG! OMG! OMG! OMG! OMG!

Isn’t that what I’ve been saying the entire time? ;D

But you said to delete it >:( And you let me do triple post.

I don’t understand what you are doing, so you are still dealing with two different versions ?

So do I. I just change the export order. You know, fourth tab on eclipse’s build path window.

Dont ever do that. Just remove the wrong version from you project completely.
Such things can make you very unhappy… as you already painfully saw.

Look again my earlier post showing tree of the jars. The old one is contained inside other lib, and sure I can’t just go in and delete it. The old one (freechart11) is classpathed by fuzzy lib.

Of course you can go in and delete the old one. Jars are Zips :stuck_out_tongue:

But of course, you don’t want to do that since the fuzzy lib compiled against the old one which it included, so all you had to do was remove the ‘new’ one.