Re: Trying to learn how to use jogl. Need help!
Posted by Wade Walker on Aug 30, 2014; 8:28pm
URL: https://forum.jogamp.org/Trying-to-learn-how-to-use-jogl-Need-help-tp4032957p4032992.html
You might want to read up on how the Java classpath works, just so you're not trying stuff at random :) It's often confusing to newcomers, and it took me a while to fully understand.
There are lots of different ways to set up your source and class directories. Here's how I'd normally lay out the directory tree for your project:
test
jar
gluegen-rt.jar
gluegen-rt-natives-*.jar (one file per target OS)
jogl-all.jar
jogl-all-natives-*.jar (one file per target OS)
src
joglDemo
OneTriangle.java
OneTriangleSwingGLJPanel.java
class
joglDemo
OneTriangle.class
OneTriangleSwingGLJPanel.class
OneTriangleSwingGLJPanel$1.class
OneTriangleSwingGLJPanel$2.class
Then I'd cd into the test directory and type "java -classpath "jar/gluegen-rt.jar:jar/jogl-all.jar:class" joglDemo.OneTriangleSwingGLJPanel", and it should run.
Don't worry about the OneTriangleSwingGLJPanel$1.class and OneTriangleSwingGLJPanel$2.class files. The compiler generates those for the anonymous inner classes "new GLEventListener() {...}" and "new WindowAdapter() {...}" inside of OneTriangleSwingGLJPanel.java. Those extra class files are normal, and are needed to run the program.