Re: Command-line compile/run quickstart
Posted by
gouessej on
Aug 08, 2013; 7:55am
URL: https://forum.jogamp.org/Command-line-compile-run-quickstart-tp4029755p4029756.html
Hi
pixelmike wrote
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.
There is a wiki, for noobs and other people. There are already some precise indications in this wiki to help people building JogAmp projects and theirs both in command line and in their IDEs (for all supported operating systems except Android):
http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE#Compile_and_run_your_project_from_the_command_linehttp://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDEIn my humble opinion, the problem is that the page above shouldn't be named "Setting up a JogAmp project in your favorite IDE" but rather "Setting up a JogAmp project" in order to avoid the confusion you probably made. According to the title, people can assume that it contains nothing about the settings in command line.
pixelmike wrote
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.)
There are some rudimentary examples in jogl-demos and
a very simple one on the official Wikipedia page of JOGL.
pixelmike wrote
Here is one:
https://github.com/sgothel/jogl-demos/blob/master/src/demos/GLInfo.javaHere's another:
https://github.com/sgothel/jogl-demos/blob/master/src/demos/texture/TestTexture.javaor browse the demos directory for something else if you prefer:
https://github.com/sgothel/jogl-demos/tree/master/src/demosNOTE: 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...!
Setting the Java library path shouldn't be necessary, you probably did something wrong. That's why I advise everyone who would like to compile JogAmp projects in command line to read the official user guide and to read
this section of the wiki.
Anyway, thank you. You just want to help. If some aspects aren't clear for you, let's talk about them and we will improve the wiki together.