Login  Register

Beginner Deployment Questions

Posted by cinolt on Jan 26, 2014; 5:39pm
URL: https://forum.jogamp.org/Beginner-Deployment-Questions-tp4031359.html

This is more of a question with Java in general, but I hope you don't mind. I'm a beginner to Java in general.

I am using the JDK 8 for Java SE, targeting for desktop platforms.

For Java, I understand that there's several ways of deploying an application, to name a few:
1) as an Applet, that runs inside a web browser,
2) Web Start (JNLP)? which I believe can be run inside a browser or desktop but connects to a server for updates and the like,
3) and as a JAR, which is simply an archive of the application files.

For now I only care about deploying as a JAR.

I've read the documentation on Oracle for using the command-line utilities for creating a JAR by specifying a Manifest file and the class files, which I was able to get working for a "Hello World" application.

Now the problem is how 3rd party libraries come into the picture. I know with asm/C/C++ you  simply statically link the libraries or provide DLL's for them. How is this usually handled with Java?

First, I followed the tutorial here: http://www3.ntu.edu.sg/home/ehchua/programming/opengl/JOGL2.0.html

I downloaded "jogamp-all-platforms" into C:\, then modified my CLASSPATH environment variable into: ".;C:\jogamp-all-platforms\jar\jogl-all.jar;C:\jogamp-all-platforms\jar\gluegen-rt.jar".

Then I compiled one of the sample programs in the tutorial into "Test.class", then simply running "java Test" works perfectly.

The problem comes with trying to JAR this program.
"java Test" works, but
"jar cfm Test.jar Manifest.txt Test.class"
"java -jar Tech.jar"
comes up with
"Error: Could not find or load main class Test"

I tried manually specifying CLASSPATH as a command line parameter, but it doesn't work.

I know this is not a problem with JAR itself, because I was able to get JAR working for a Hello World application. So the problem is obviously with JAR'ing with a third party library.

Any advice on this issue?