Login  Register

Command-line compile/run quickstart

Posted by pixelmike on Aug 07, 2013; 9:14pm
URL: https://forum.jogamp.org/Command-line-compile-run-quickstart-tp4029755.html

Since this took the better part of the day to figure out, I thought I'd post what I did to get an example up and running on Windows. (Probably works with minor tweaks on other platforms as well.) This site is fairly impenetrable to noobs like me.

I didn't want to spend a lot of time figuring out Eclipse, I just wanted to try compiling and running a simple Java/OpenGL example.

(I'm assuming you know how to and have already set up the JDK on your system and know how to compile/run normal java apps, and that you have your PATH, CLASSPATH and JAVA_HOME environment variables setup.)

1. Download jogamp-all-platforms from here. Extract with 7-zip.

2. Find a simple standalone app to compile. (Harder than you'd think! The demos package download doesn't come with source. Pulling from the GIT repo was so slow it would take all day.)

Here is one:
https://github.com/sgothel/jogl-demos/blob/master/src/demos/GLInfo.java
Here's another:
https://github.com/sgothel/jogl-demos/blob/master/src/demos/texture/TestTexture.java
or browse the demos directory for something else if you prefer:
https://github.com/sgothel/jogl-demos/tree/master/src/demos

NOTE: comment out the first line:
 // package demos;
before compiling, otherwise I couldn't get the compiled classes to run.

If you download GLInfo.java to a directory with the jogamp-all-platforms directory below it, you can compile GLInfo.java with the following:

javac -cp "%CLASSPATH%;jogamp-all-platforms/jar/*" GLInfo.java

I got one warning, but otherwise it compiled ok.

Then run it with:

java -cp "%CLASSPATH%;jogamp-all-platforms/jar/*" -Djava.library.path="jogamp-all-platforms/lib/windows-i586" GLInfo

If you like using Cygwin like I do, those two lines would be:

javac -cp "$CLASSPATH;jogamp-all-platforms/jar/*" GLInfo.java
java -cp "$CLASSPATH;jogamp-all-platforms/jar/*" -Djava.library.path="jogamp-all-platforms/lib/windows-i586" GLInfo

FINALLY I can start tinkering...!