Thursday, July 1, 2010

java.lang.NoClassDefFoundError: javax/media/jai/iterator/RandomIter

Man, this is the last time you fool me!
At least so I wished... anyways...
You are writing an eclipse RCP application that bases also on JAI?

Well, you might incur into the error:
java.lang.NoClassDefFoundError: javax/media/jai/iterator/RandomIter

or something similar.
Also you would swear that the jars are in your classpath.
Also you will browse the whole internet for solutions.
Also you won't find them. (at least I didn't)
Because the ease of all this is in running the application with the following VM argument:

-Dosgi.parentClassloader=ext



When I don't create new RCP apps in a while it fools me again. Also you should not try to solve this between 11 pm and 1 am. It would fool you... again.




As suggested a small addition: In my case the problem is due to the fact I use to keep the jai jars inside the jre and therefore it is needed to tell the classloader to load also the jre extentions (which is where I keep the jars).

3 comments:

Devrim Baris Acar said...

Do you know why that config option is needed?

moovida said...

Hi Devrim,
perhaps I should have added that.
In fact in my case it is due to the fact I use to keep the jai jars inside the jre and therefore it is needed to tell the classloader to load also the jre extentions (which is where I keep the jars).

Devrim Baris Acar said...

Thanks for the explanation :)