We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Processing with external library + HTML
Page Index Toggle Pages: 1
Processing with external library + HTML (Read 1504 times)
Processing with external library + HTML
Apr 28th, 2009, 12:12pm
 
I have completed a project using processing and the Traer physics library. The executable versions work fine, however, when I try to run the exported html I get this error:

java.lang.NoClassDefFoundError: traer/physics/Particle
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethod(Unknown Source)
at java.awt.Component.isCoalesceEventsOverriden(Unknown Source)
at java.awt.Component.access$300(Unknown Source)
at java.awt.Component$3.run(Unknown Source)
at java.awt.Component$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Component.checkCoalescing(Unknown Source)
at java.awt.Component.(Unknown Source)
at java.awt.Container.(Unknown Source)
at java.awt.Panel.(Unknown Source)
at java.awt.Panel.(Unknown Source)
at java.applet.Applet.(Unknown Source)
at processing.core.PApplet.(PApplet.java:162)
at tadpoles.(tadpoles.java:19)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: traer.physics.Particle
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 25 more
Caused by: java.io.FileNotFoundException: C:\Users\Marie\Documents\Processing\tadpoles\applet\traer\physics\Particle.class
(The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileInputStream.(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 29 more
Exception: java.lang.NoClassDefFoundError: traer/physics/Particle

Error code is here too (incase the forum doesn't like it!) www.mariewilkins.co.uk/processing_error.html

I assume this means somehow I need to include the physics library files... but where and how

Thanks, Marie
Re: Processing with external library + HTML
Reply #1 - Apr 28th, 2009, 1:14pm
 
Like you said, the problem is that the applet (I'm assuming you're running an applet as you said it was on a HTML page) cannot find the required libraries.  YOu've got two options I believe:

[list=1]
  • Create one "fat" jar file that is all your required libraries packed into one jar that you then deploy
  • Try using the archive tag in your HTML:
    Code:
    <applet code="MyClass.class" ARCHIVE="libraryone.jar, librarytwo.jar" width="400" height="500"></APPLET>


  • I've not touched applets for a long time though so I could be way off!
    Re: Processing with external library + HTML
    Reply #2 - Apr 28th, 2009, 1:29pm
     
    Thanks, Leesy! It works!
         <param name="archive" value="tadpoles.jar,core.jar,physics.jar" />
    ...solved all my problems!!
    Page Index Toggle Pages: 1