Installing or Setting up JOGL on Ubuntu

gl_java_ubuntu1

Here are the detailed steps to set up or install JOGL on your ubuntu. First of all you have to download the jogl library(according to your machine) from here . I am using Ubuntu 8.04 on intel board so i downloaded jogl-1.1.1-linux-i586.zip.

So extract the zip file. Now open the folder that you have just now extracted. Go to lib folder.

STEP 1: Now you have to copy four .so files i.e libjogl.so, libjogl_awt.so, libjogl_cg.so, libgluegen-rt.so to [javainstalation directory]/jre/lib/i386

Open the terminal window and type: sudo cp libjogl.so /usr/lib/java/jdk1.6.0_13/jre/lib/i386

similarly you have to copy other three .so files.

*you have to provide you java installation path*

jogl1

Now you can check the destination if files has been copied.

jogl21

STEP 2: Now copy jogl.jar and gluegen-rt.jar to [java installation di]/jre/lib/ext

run this command to copy: sudo cp jogl.jar /usr/lib/java/jdk1.6.0_13/jre/lib/ext

simillarly copy gluegen-rt.jar

*you have to provide your java installation path*

jogl3

You can check:

jogl4

STEP 3: SO thats it. Now lets test the simple jogl code.

import javax.media.opengl.GLCapabilities;

public class Hello{
public static void main (String args[]) {
try {
System.loadLibrary(“jogl”);
System.out.println(
“Hello World! (The native libraries are installed.)”
);
GLCapabilities caps = new GLCapabilities();
System.out.println(
“Hello JOGL! (The jar appears to be available.)”
);
} catch (Exception e) {
System.out.println(e);
}
}
}

Now compile this Hello.java and the run it. Here is the output:

jogl-final

So thats it. Now your are off to fly and write your jogl apps.

Thanks.

This entry was posted in Tutorials, developer, java and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

So far 1,038 views

2 Comments

  1. Posted October 2, 2009 at 3:04 pm | Permalink

    1. it is a very bad idea to deploy jogl in your jre, this will break a lot of apps. (esp. webstart and applets)
    2. don’t load jogl natives explicitly it is already done by jogl.

    -cp and -Djava.library.path is all you need to start a app with jar and native dependencies (in general) via cmd line. If you want to use applets or webstart just take a look at the jnlp extensions provided by jogl.

    In other words: don’t follow this howto

  2. Posted October 4, 2009 at 7:30 am | Permalink

    Yeah michael bien is very correct. The above howto that i wrote is not very recommended. I am not a regular Ubuntu user and i was having problem setting classpath on ubuntu linux so i hacked it around and get my jogl app working using above steps.

    Gracias.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

  • Become a GaanZa Fan

    GaanZa on Facebook