On 08/10/2010 08:34 PM, Lothar Werzinger wrote: > On Tuesday, August 10, 2010, Andrew Haley wrote: >> On 08/10/2010 08:08 PM, Lothar Werzinger wrote: >>> On Tuesday, August 10, 2010, Andrew Haley wrote: >>>> On 08/10/2010 05:51 PM, Lothar Werzinger wrote: >>>>> I would expect a NoClassDefFoundError for the jython script engine >>>>> itself, as I did not provide it on the classpath, but >>>>> ScriptEngineManager is in the shared library compiled from the jar, so >>>>> why do I get a NoClassDefFoundError? >>>> >>>> You need to compile your main program -fPIC. >>> >>> Hmm, OK I forgot that, too. Have it in my app, though. >>> >>>> If you really want to know why, I can explain... :-) >>>> >>>> Andrew. >>> >>> As my app needs the "Bindings" Class from JSR 223 and the downloaded jar >>> did for some reason not contain it I tried extracting javax/scripting >>> from a JDK1.6 rt.jar >>> >>> Now the ominous NoClassDefFoundError is back. Any ideas? >>> >>> $ ./build.sh >>> testgcj >>> Create JavaVM ... >>> Create JavaVM done. >>> Java Exception: >>> java.lang.NoClassDefFoundError: javax.script.ScriptEngineManager >> >> I don't know what is causing this. I'll debug it tomorrow. > > Thanks, I appreciate that very much! I'm not seeing any problem with javax.script.ScriptEngineManager. Well, I was, but I had duplicate copies of that class. You really do need PrintStackTrace(). I now see: java.lang.NoClassDefFoundError: com.sun.script.javascript.RhinoScriptEngineFactory at java.lang.Class.initializeClass(natClass.cc:730) at java.lang.Class.forName(natClass.cc:111) at java.lang.Class.forName(Class.java:133) at javax.script.ScriptEngineManager.addSpi(ScriptEngineManager.java:320) at javax.script.ScriptEngineManager.<init>(ScriptEngineManager.java:70) Caused by: java.lang.ClassNotFoundException: org.mozilla.javascript.Context not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}} at java.net.URLClassLoader.findClass(URLClassLoader.java:531) at java.lang.ClassLoader.loadClass(ClassLoader.java:452) at java.lang.ClassLoader.loadClass(ClassLoader.java:387) at java.lang.Class.initializeClass(natClass.cc:720) ...4 more Andrew.
Attachment:
build.sh
Description: Bourne shell script