I am trying to develop a Java applet for scientific purposes. I am working in Eclipse, on Ubuntu 11.04; since I needed some additional features, I included the libraries “flanagan.jar”, “jcommons.jar” and “jfreechart.jar”. Now, when I run the applet from inside Eclipse everything goes fine. When I try to do so OUTSIDE of Eclipse, however, not quite. To say a few examples:
1) if I try to run it by embedding it into an HTML file with or tags, the applet fails and I get an error because the definitions for the classes taken from the libraries are missing, even though I placed them in the same folder and used the proper archive value to tell the browser where to look for them;
2) if I try to compile the applet with javac, by inserting:
javac -classpath sourcefile.java library1.jar library2.jar
I get an error saying that the class names for the .jar files are only accepted if annotation processing is explicitly requested.
3) I can find no way to produce a single output .jar file embedding all the required library files. I also think it would be neat if I could avoid embedding the entire libraries (they weigh something around ~4 MB) and actually use only the .class files I really need. I don’t know how to do however. Could you give me some suggestion on how to do one of the three things above?
You need to place your jar list immediately after the
-classpathargument using a colon:demilited list:You could use Eclipse to produce a single output jar by using:
Then you can either jar up the content of the new jar file sub-folder or use: