I’m new to JOGL, and I’m just trying to get it installed and working for the first time - I’ve installed the Java natives (I’m on Win XP) in system32, and put the jogl.jar in a directory where I know where it is. I then put that directory in the classpath environment variable (or try running “java -cp “\file.jar” -jar .jar” at the command line), and it gives me an error that it can’t find the GLDrawable class. However, if I move jogl.jar to my jre/lib/ext folder, it works! Why would the classpath be ignored for jogl?
If you are using the -jar command line, you don’t need to also include the classpath to the same JAR file. The only other thing I can think of is if you have the path wrong. Also, if you have the path wrongly defined (not using semi colons for example) the path may be munged. The easy way to test for this is using the javap command and seeing where the classes are located. It’s certainly not a Java problem as this is the way we run all our applications, so you’ve probably got some typos in there somewhere.
It’s not the classpath to the jar of the program that I’m specifying - the classpath needs to point to the jogl.jar file. As I understand it, the -jar is applied to the class you’re executing, not the classpath. And I tried using javap to specify it, and it located the GLCanvas class only if I specified the classpath, but then using the EXACT same classpath with java to try to execute the program, it gives me the error that it can’t find GLEventListener.
One possible important point - My installed both a JRE and a JDK folder, and the java command seems to be referencing the JRE version (that is, it’s the JRE/lib/ext that I’m putting jogl.jar into, not JDK/jre/lib/ext). javap, on the other hand, is only in the JDK distribtuion. I wouldn’t think this would matter, though - the “-classpath” option should work the same for both…
Using the -jar argument to java overrides the specification of the classpath either on the command line or via the CLASSPATH environment variable (to the best of my knowledge). You should probably add your jar file to your CLASSPATH environment variable along with the jogl.jar and just invoke the main class (java -Dsun.java2d.noddraw=true my.class.Name).
I just looked up the -jar option and Ken is correct - the -cp option is ignored when you specify a JAR file to run. You end up needing to have all the JARs you need in the same directory as the executed JAR file and reference them in the Class-Path attribute in the manifest file.
Here’s the appropriate quote from the JDK 1.4 documentation:
I have also had this problem, yet I include jogl.jar in my jar file from which I am executing. The only way I am able to get it to execute properly is to first unpack the jogl jar file.
JARs within JARs are not handled. YOu need to have them in the same directory and make sure that you have the Class-Path attribute of your manifest set to name all the other JAR files that it needs.