Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Title says it all. I have installed everything, yet javac behaves like nothing has happened - No OpenGL objects are found when I try to compile copy-pasted code from tutorials. None.

I'm using the command-line javac from OpenJDK and Eclipse with standard settings. No go with either.

Why?

share|improve this question

1 Answer 1

You still need to tell javac to add the jar files containing the JOGL classes on the classpath.

If you use JogAmp JOGL 2 then include the two jar files gluegen-rt.jar and jogl-all.jar on the classpath:

Example download the latest jars from JogAmp and compile a simple application from command line:

#install p7zip-full required to unpack 7z files.
sudo apt-get install p7zip-full
#download and unpack the latest JogAmp JOGL release
wget http://jogamp.org/deployment/jogamp-current/archive/jogamp-all-platforms.7z
7z x jogamp-all-platforms.7z
cd jogamp-all-platforms
#download a simple JOGL example application
mkdir -p demos/es2
cd demos/es2
wget https://raw.github.com/xranby/jogl-demos/master/src/demos/es2/RawGL2ES2demo.java
cd ../..
#compile the jogl example application using javac
javac -cp jar/jogl-all.jar:jar/gluegen-rt.jar demos/es2/RawGL2ES2demo.java
#run the example jogl application
java -cp jar/jogl-all.jar:jar/gluegen-rt.jar:. demos.es2.RawGL2ES2demo

Example2 compile a simple jogl application using jars provided by the Debian/Ubuntu libjogl2-java package: Ubuntu uses the names gluegen2-rt.jar and jogl2.jar

sudo apt-get install libjogl2-java
#download a simple JOGL example application
mkdir -p demos/es2
cd demos/es2
wget https://raw.github.com/xranby/jogl-demos/master/src/demos/es2/RawGL2ES2demo.java
cd ../..
#compile the jogl example application using javac
javac -cp /usr/share/java/jogl2.jar:/usr/share/java/gluegen2-rt.jar demos/es2/RawGL2ES2demo.java
#run the example jogl application
java -cp .:/usr/share/java/jogl2.jar:/usr/share/java/gluegen2-rt.jar demos/es2/RawGL2ES2demo

Note that Oracle have stopped supporting JOGL 1 since 2009. The JogAmp community maintains JOGL 2. https://jogamp.org/jogl/doc/Overview-OpenGL-Evolution-And-JOGL.html http://labb.zafena.se/?p=656 - The JogAmp community now maintains JOGL and Java3D

Most developers use JogAmp JOGL from inside Java IDE such as NetBeans and Eclipse, here is a link on how to setup your development environment. https://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.