Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
I want to make Java OpenGL acceleration work in Java Applets
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Shining Arcanine
Veteran
Veteran


Joined: 24 Sep 2009
Posts: 1110

PostPosted: Thu May 13, 2010 6:09 pm    Post subject: I want to make Java OpenGL acceleration work in Java Applets Reply with quote

I want to make Java OpenGL acceleration work in Java Applets. I did some research via google and apparently, I need to use JOGL, which is avaliable from the "java-overlay" overlay:

https://bugs.gentoo.org/show_bug.cgi?id=50178

I installed it and I am having some difficulty getting things to work. I found a guide that says that I need to add some paths to CLASSPATH and LD_LIBRARY_PATH, but since this is for applets, I am not sure how to do that:

http://www.semiantics.com/?p=112

Does anyone have any suggestions on how to proceed? At the moment, anything I run (in particular, a game my cousin and I play together called Runescape) that uses graphics is run on the CPU, which is absurdly slow.
Back to top
View user's profile Send private message
Shining Arcanine
Veteran
Veteran


Joined: 24 Sep 2009
Posts: 1110

PostPosted: Thu May 13, 2010 6:49 pm    Post subject: Reply with quote

It seems that I need to start from scratch. I just tried running a test program from wikipedia from the commandline and it seems that following that site's advice to set those variables broke Java:

http://en.wikipedia.org/wiki/Java_OpenGL

Setting those variables enabled me to compile a class file for the test program, but running it or doing anything else would fail, including a simple hello world program I copied and pasted from the internet. Unsetting the variables made things work again, but of course, the test program for JOGL that I was trying to run will not work. :/

Code:
$ java JOGLTetrahedron
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLEventListener
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLEventListener
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        ... 12 more
Could not find the main class: JOGLTetrahedron.  Program will exit.
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2535

PostPosted: Thu May 13, 2010 6:52 pm    Post subject: Reply with quote

Are you using the sun java? Not sure how the open source variants work, but the Sun java doesn't really pay attention to the external environment. Not all computing platforms have the concept of environment variables. You can say java -Dvariable=value and then get it out of the Java environment, but everything you want transferred needs to be deliberately done, last time I checked.

FWIW though, that was quite awhile back. IMO it's such a pain in the rear, maybe they changed back and pull the environment in.

Open the Java control panel and there's a place for you to set up your environment.
Back to top
View user's profile Send private message
Shining Arcanine
Veteran
Veteran


Joined: 24 Sep 2009
Posts: 1110

PostPosted: Thu May 13, 2010 7:18 pm    Post subject: Reply with quote

1clue wrote:
Are you using the sun java? Not sure how the open source variants work, but the Sun java doesn't really pay attention to the external environment. Not all computing platforms have the concept of environment variables. You can say java -Dvariable=value and then get it out of the Java environment, but everything you want transferred needs to be deliberately done, last time I checked.

FWIW though, that was quite awhile back. IMO it's such a pain in the rear, maybe they changed back and pull the environment in.

Open the Java control panel and there's a place for you to set up your environment.


I am using Sun Java. Since I cannot seem to get JOGL working via the commandline, I do not think modifying the environment via the ControlPanel is going to help me.

So far, executing the following will compile JOGLTetrahedron.java:

Code:
javac -classpath "/usr/share/jogl/lib/jogl.jar" JOGLTetrahedron.java


Executing it is another story:

Code:
$ java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar" JOGLTetrahedron
Exception in thread "main" java.lang.NoClassDefFoundError: JOGLTetrahedron
Caused by: java.lang.ClassNotFoundException: JOGLTetrahedron
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: JOGLTetrahedron.  Program will exit.


I am still fiddling with commandline options. If I could just figure out the right mix of options to make it work, then modifying stuff via ./ControlPanel should make things work.
Back to top
View user's profile Send private message
zixnub
n00b
n00b


Joined: 27 Dec 2007
Posts: 67
Location: Brasschaat, Belgium

PostPosted: Thu May 13, 2010 7:26 pm    Post subject: Reply with quote

Shining Arcanine wrote:
1clue wrote:
Are you using the sun java? Not sure how the open source variants work, but the Sun java doesn't really pay attention to the external environment. Not all computing platforms have the concept of environment variables. You can say java -Dvariable=value and then get it out of the Java environment, but everything you want transferred needs to be deliberately done, last time I checked.

FWIW though, that was quite awhile back. IMO it's such a pain in the rear, maybe they changed back and pull the environment in.

Open the Java control panel and there's a place for you to set up your environment.


I am using Sun Java. Since I cannot seem to get JOGL working via the commandline, I do not think modifying the environment via the ControlPanel is going to help me.

So far, executing the following will compile JOGLTetrahedron.java:

Code:
javac -classpath "/usr/share/jogl/lib/jogl.jar" JOGLTetrahedron.java


Executing it is another story:

Code:
$ java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar" JOGLTetrahedron
Exception in thread "main" java.lang.NoClassDefFoundError: JOGLTetrahedron
Caused by: java.lang.ClassNotFoundException: JOGLTetrahedron
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: JOGLTetrahedron.  Program will exit.


I am still fiddling with commandline options. If I could just figure out the right mix of options to make it work, then modifying stuff via ./ControlPanel should make things work.


Just guessing but:

Do you include the dir of your class in the classpath if you try to run it? Not sure if that will solve it but looking at your run command java looks at the 2 jars for JOGLTetrahedron which obviously doesn't include it.

Code:
java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar:dirToJOGLTetrahedronExcludingPackage" packageIfAny.JOGLTetrahedron

_________________
https://github.com/udevbe/greenfield
https://github.com/udevbe/westfield
Back to top
View user's profile Send private message
Shining Arcanine
Veteran
Veteran


Joined: 24 Sep 2009
Posts: 1110

PostPosted: Thu May 13, 2010 7:34 pm    Post subject: Reply with quote

zixnub wrote:
Shining Arcanine wrote:
1clue wrote:
Are you using the sun java? Not sure how the open source variants work, but the Sun java doesn't really pay attention to the external environment. Not all computing platforms have the concept of environment variables. You can say java -Dvariable=value and then get it out of the Java environment, but everything you want transferred needs to be deliberately done, last time I checked.

FWIW though, that was quite awhile back. IMO it's such a pain in the rear, maybe they changed back and pull the environment in.

Open the Java control panel and there's a place for you to set up your environment.


I am using Sun Java. Since I cannot seem to get JOGL working via the commandline, I do not think modifying the environment via the ControlPanel is going to help me.

So far, executing the following will compile JOGLTetrahedron.java:

Code:
javac -classpath "/usr/share/jogl/lib/jogl.jar" JOGLTetrahedron.java


Executing it is another story:

Code:
$ java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar" JOGLTetrahedron
Exception in thread "main" java.lang.NoClassDefFoundError: JOGLTetrahedron
Caused by: java.lang.ClassNotFoundException: JOGLTetrahedron
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: JOGLTetrahedron.  Program will exit.


I am still fiddling with commandline options. If I could just figure out the right mix of options to make it work, then modifying stuff via ./ControlPanel should make things work.


Just guessing but:

Do you include the dir of your class in the classpath if you try to run it? Not sure if that will solve it but looking at your run command java looks at the 2 jars for JOGLTetrahedron which obviously doesn't include it.

Code:
java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar:dirToJOGLTetrahedronExcludingPackage" packageIfAny.JOGLTetrahedron


The JOGLTetrahedron class is in the sample application from wikipedia and the main method is in it. There is no path to the class to include because the class is in the file I am attempting to execute.

Here is a copy and paste from wikipedia:

Code:
import javax.media.opengl.GL;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.glu.GLU;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.media.opengl.GLCanvas;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import com.sun.opengl.util.Animator;
 
public class JOGLTetrahedron implements GLEventListener, KeyListener {
    float rotateT = 0.0f;
    static GLU glu = new GLU();
    static GLCanvas canvas = new GLCanvas();
    static Frame frame = new Frame("Jogl 3D Shape/Rotation");
    static Animator animator = new Animator(canvas);
    public void display(GLAutoDrawable gLDrawable) {
        final GL gl = gLDrawable.getGL();
        gl.glClear(GL.GL_COLOR_BUFFER_BIT);
        gl.glClear(GL.GL_DEPTH_BUFFER_BIT);
        gl.glLoadIdentity();
        gl.glTranslatef(0.0f, 0.0f, -5.0f);
 
        gl.glRotatef(rotateT, 1.0f, 0.0f, 0.0f);
        gl.glRotatef(rotateT, 0.0f, 1.0f, 0.0f);
        gl.glRotatef(rotateT, 0.0f, 0.0f, 1.0f);
        gl.glRotatef(rotateT, 0.0f, 1.0f, 0.0f);
 
        gl.glBegin(GL.GL_TRIANGLES);
 
        // Front
        gl.glColor3f(0.0f, 1.0f, 1.0f);
        gl.glVertex3f(0.0f, 1.0f, 0.0f);
        gl.glColor3f(0.0f, 0.0f, 1.0f);
        gl.glVertex3f(-1.0f, -1.0f, 1.0f);
        gl.glColor3f(0.0f, 0.0f, 0.0f);
        gl.glVertex3f(1.0f, -1.0f, 1.0f);
 
        // Right Side Facing Front
        gl.glColor3f(0.0f, 1.0f, 1.0f);
        gl.glVertex3f(0.0f, 1.0f, 0.0f);
        gl.glColor3f(0.0f, 0.0f, 1.0f);
        gl.glVertex3f(1.0f, -1.0f, 1.0f);
        gl.glColor3f(0.0f, 0.0f, 0.0f);
        gl.glVertex3f(0.0f, -1.0f, -1.0f);
 
        // Left Side Facing Front
        gl.glColor3f(0.0f, 1.0f, 1.0f);
        gl.glVertex3f(0.0f, 1.0f, 0.0f);
        gl.glColor3f(0.0f, 0.0f, 1.0f);
        gl.glVertex3f(0.0f, -1.0f, -1.0f);
        gl.glColor3f(0.0f, 0.0f, 0.0f);
        gl.glVertex3f(-1.0f, -1.0f, 1.0f);
 
        // Bottom
        gl.glColor3f(0.0f, 0.0f, 0.0f);
        gl.glVertex3f(-1.0f, -1.0f, 1.0f);
        gl.glColor3f(0.1f, 0.1f, 0.1f);
        gl.glVertex3f(1.0f, -1.0f, 1.0f);
        gl.glColor3f(0.2f, 0.2f, 0.2f);
        gl.glVertex3f(0.0f, -1.0f, -1.0f);
 
        gl.glEnd();
 
        rotateT += 0.2f;
    }
 
    public void displayChanged(GLAutoDrawable gLDrawable,
                               boolean modeChanged, boolean deviceChanged) {
    }
 
    public void init(GLAutoDrawable gLDrawable) {
        GL gl = gLDrawable.getGL();
        gl.glShadeModel(GL.GL_SMOOTH);
        gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        gl.glClearDepth(1.0f);
        gl.glEnable(GL.GL_DEPTH_TEST);
        gl.glDepthFunc(GL.GL_LEQUAL);
        gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT,
                  GL.GL_NICEST);
        gLDrawable.addKeyListener(this);
    }
 
    public void reshape(GLAutoDrawable gLDrawable, int x,
                        int y, int width, int height) {
        GL gl = gLDrawable.getGL();
        if(height <= 0) {
            height = 1;
        }
        float h = (float)width / (float)height;
        gl.glMatrixMode(GL.GL_PROJECTION);
        gl.glLoadIdentity();
        glu.gluPerspective(50.0f, h, 1.0, 1000.0);
        gl.glMatrixMode(GL.GL_MODELVIEW);
        gl.glLoadIdentity();
    }
 
    public void keyPressed(KeyEvent e) {
        if(e.getKeyCode() == KeyEvent.VK_ESCAPE) {
            exit();
        }
    }
 
    public void keyReleased(KeyEvent e) {
    }
 
    public void keyTyped(KeyEvent e) {
    }
 
    public static void exit(){
        animator.stop();
        frame.dispose();
        System.exit(0);
    }
 
    public static void main(String[] args) {
        canvas.addGLEventListener(new JOGLTetrahedron());
        frame.add(canvas);
        frame.setSize(640, 480);
        frame.setUndecorated(true);
        frame.setExtendedState(Frame.MAXIMIZED_BOTH);
        frame.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    exit();
                }
            });
        frame.setVisible(true);
        animator.start();
        canvas.requestFocus();
    }
}
Back to top
View user's profile Send private message
zixnub
n00b
n00b


Joined: 27 Dec 2007
Posts: 67
Location: Brasschaat, Belgium

PostPosted: Thu May 13, 2010 7:52 pm    Post subject: Reply with quote

Shining Arcanine wrote:


The JOGLTetrahedron class is in the sample application from wikipedia and the main method is in it. There is no path to the class to include because the class is in the file I am attempting to execute.


Try my solution and post the output instead of dismissing it plz.

If it works I'll explain why it works and yours doesn't if it doesn't work I'll try to help you further.
_________________
https://github.com/udevbe/greenfield
https://github.com/udevbe/westfield
Back to top
View user's profile Send private message
Shining Arcanine
Veteran
Veteran


Joined: 24 Sep 2009
Posts: 1110

PostPosted: Thu May 13, 2010 7:55 pm    Post subject: Reply with quote

There does not appear to be any change:

Code:
$ java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar:~/" JOGLTetrahedron
Exception in thread "main" java.lang.NoClassDefFoundError: JOGLTetrahedron
Caused by: java.lang.ClassNotFoundException: JOGLTetrahedron
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: JOGLTetrahedron.  Program will exit.


I even tried a few variations of this and it did not work:

Code:
$ java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar:/home/richard/JOGLTetrahedron.class" JOGLTetrahedron
Exception in thread "main" java.lang.NoClassDefFoundError: JOGLTetrahedron
Caused by: java.lang.ClassNotFoundException: JOGLTetrahedron
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: JOGLTetrahedron.  Program will exit.
Back to top
View user's profile Send private message
zixnub
n00b
n00b


Joined: 27 Dec 2007
Posts: 67
Location: Brasschaat, Belgium

PostPosted: Thu May 13, 2010 7:59 pm    Post subject: Reply with quote

hmm...

try:

Code:
java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar:/home/richard" JOGLTetrahedron

_________________
https://github.com/udevbe/greenfield
https://github.com/udevbe/westfield
Back to top
View user's profile Send private message
Shining Arcanine
Veteran
Veteran


Joined: 24 Sep 2009
Posts: 1110

PostPosted: Fri May 14, 2010 1:51 am    Post subject: Reply with quote

zixnub wrote:
hmm...

try:

Code:
java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar:/home/richard" JOGLTetrahedron


Now the error message has changed:

Code:
$ java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar:/home/richard" JOGLTetrahedron
Exception in thread "main" java.lang.UnsatisfiedLinkError: no gluegen-rt in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)
        at java.lang.Runtime.loadLibrary0(Runtime.java:823)
        at java.lang.System.loadLibrary(System.java:1028)
        at com.sun.gluegen.runtime.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:102)
        at com.sun.gluegen.runtime.NativeLibLoader.access$000(NativeLibLoader.java:51)
        at com.sun.gluegen.runtime.NativeLibLoader$1.run(NativeLibLoader.java:70)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.gluegen.runtime.NativeLibLoader.loadGlueGenRT(NativeLibLoader.java:68)
        at com.sun.gluegen.runtime.NativeLibrary.ensureNativeLibLoaded(NativeLibrary.java:399)
        at com.sun.gluegen.runtime.NativeLibrary.open(NativeLibrary.java:163)
        at com.sun.gluegen.runtime.NativeLibrary.open(NativeLibrary.java:129)
        at com.sun.opengl.impl.x11.DRIHack.begin(DRIHack.java:109)
        at com.sun.opengl.impl.x11.X11GLDrawableFactory.<clinit>(X11GLDrawableFactory.java:99)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:111)
        at javax.media.opengl.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:520)
        at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:131)
        at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:90)
        at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:83)
        at JOGLTetrahedron.<clinit>(JOGLTetrahedron.java:16)
Could not find the main class: JOGLTetrahedron.  Program will exit.


I again tried a few variations on this and the error messages changed enough time. They seem to be becoming more encouraging:

Code:
$ java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/:/home/richard" JOGLTetrahedron
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/gluegen/runtime/DynamicLookupHelper
        at JOGLTetrahedron.<clinit>(JOGLTetrahedron.java:15)
Caused by: java.lang.ClassNotFoundException: com.sun.gluegen.runtime.DynamicLookupHelper
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        ... 1 more
Could not find the main class: JOGLTetrahedron.  Program will exit.


Code:
$ java -classpath "/usr/share/jogl/lib/:/usr/share/gluegen/lib/:/home/richard" JOGLTetrahedron
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLEventListener
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLEventListener
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        ... 12 more
Could not find the main class: JOGLTetrahedron.  Program will exit.
Back to top
View user's profile Send private message
zixnub
n00b
n00b


Joined: 27 Dec 2007
Posts: 67
Location: Brasschaat, Belgium

PostPosted: Fri May 14, 2010 7:33 am    Post subject: Reply with quote

Shining Arcanine wrote:
zixnub wrote:
hmm...

try:

Code:
java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar:/home/richard" JOGLTetrahedron


Now the error message has changed:

Code:
$ java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar:/home/richard" JOGLTetrahedron
Exception in thread "main" java.lang.UnsatisfiedLinkError: no gluegen-rt in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)
        at java.lang.Runtime.loadLibrary0(Runtime.java:823)
        at java.lang.System.loadLibrary(System.java:1028)
        at com.sun.gluegen.runtime.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:102)
        at com.sun.gluegen.runtime.NativeLibLoader.access$000(NativeLibLoader.java:51)
        at com.sun.gluegen.runtime.NativeLibLoader$1.run(NativeLibLoader.java:70)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.gluegen.runtime.NativeLibLoader.loadGlueGenRT(NativeLibLoader.java:68)
        at com.sun.gluegen.runtime.NativeLibrary.ensureNativeLibLoaded(NativeLibrary.java:399)
        at com.sun.gluegen.runtime.NativeLibrary.open(NativeLibrary.java:163)
        at com.sun.gluegen.runtime.NativeLibrary.open(NativeLibrary.java:129)
        at com.sun.opengl.impl.x11.DRIHack.begin(DRIHack.java:109)
        at com.sun.opengl.impl.x11.X11GLDrawableFactory.<clinit>(X11GLDrawableFactory.java:99)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:111)
        at javax.media.opengl.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:520)
        at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:131)
        at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:90)
        at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:83)
        at JOGLTetrahedron.<clinit>(JOGLTetrahedron.java:16)
Could not find the main class: JOGLTetrahedron.  Program will exit.


I again tried a few variations on this and the error messages changed enough time. They seem to be becoming more encouraging:

Code:
$ java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/:/home/richard" JOGLTetrahedron
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/gluegen/runtime/DynamicLookupHelper
        at JOGLTetrahedron.<clinit>(JOGLTetrahedron.java:15)
Caused by: java.lang.ClassNotFoundException: com.sun.gluegen.runtime.DynamicLookupHelper
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        ... 1 more
Could not find the main class: JOGLTetrahedron.  Program will exit.


Code:
$ java -classpath "/usr/share/jogl/lib/:/usr/share/gluegen/lib/:/home/richard" JOGLTetrahedron
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLEventListener
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLEventListener
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        ... 12 more
Could not find the main class: JOGLTetrahedron.  Program will exit.


You can ignore the other 2 errors, the first run command is the correct one.

As for the error. It seems there is a certain C/C++ library (gluegen-rt.so) that is needed but can't be found (or is compiled for an incorrect architecture) by the java vm. This has to do with linking the java vm with native libraries. See java with jni.
You can google for it, a lot of people seem to have the same problem:
http://www.google.be/search?hl=nl&client=firefox-a&hs=Dup&rls=org.mozilla%3Aen-US%3Aofficial&q=no+gluegen-rt+in+java.library.path

As for why the first command is it the correct one:

The java vm doesn't look at the relative path when you execute it with the classpath argument.
What you basically do by specifying the classpath (which is always a list of directories or jar files, never other individual files!) is telling where the java vm can find all the classes(=class files) that are needed for the application to run. So when you say

Code:
java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar:/home/richard" JOGLTetrahedron


You say all the necessary classes can be found in jogl.jar (jar files are specially crafted zip files ~= a compressed directory), gluegen-rt.jar and in the /home/richard directory. The last argument of the command "JOGLTetrahedron" is telling the java vm in what class the main method can be found. So what happens is that the java-vm first looks for the JOGLTetrahedron class (=it looks for the JOGLTetrahedron.class file, which can be found in the /home/richard directory) and then executes it's main method.

In other words when you get a "java.lang.ClassNotFoundException", it means your classpath is incomplete or wrong.
_________________
https://github.com/udevbe/greenfield
https://github.com/udevbe/westfield
Back to top
View user's profile Send private message
Shining Arcanine
Veteran
Veteran


Joined: 24 Sep 2009
Posts: 1110

PostPosted: Fri May 14, 2010 12:52 pm    Post subject: Reply with quote

zixnub wrote:
You can ignore the other 2 errors, the first run command is the correct one.

As for the error. It seems there is a certain C/C++ library (gluegen-rt.so) that is needed but can't be found (or is compiled for an incorrect architecture) by the java vm. This has to do with linking the java vm with native libraries. See java with jni.
You can google for it, a lot of people seem to have the same problem:
http://www.google.be/search?hl=nl&client=firefox-a&hs=Dup&rls=org.mozilla%3Aen-US%3Aofficial&q=no+gluegen-rt+in+java.library.path

As for why the first command is it the correct one:

The java vm doesn't look at the relative path when you execute it with the classpath argument.
What you basically do by specifying the classpath (which is always a list of directories or jar files, never other individual files!) is telling where the java vm can find all the classes(=class files) that are needed for the application to run. So when you say

Code:
java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar:/home/richard" JOGLTetrahedron


You say all the necessary classes can be found in jogl.jar (jar files are specially crafted zip files ~= a compressed directory), gluegen-rt.jar and in the /home/richard directory. The last argument of the command "JOGLTetrahedron" is telling the java vm in what class the main method can be found. So what happens is that the java-vm first looks for the JOGLTetrahedron class (=it looks for the JOGLTetrahedron.class file, which can be found in the /home/richard directory) and then executes it's main method.

In other words when you get a "java.lang.ClassNotFoundException", it means your classpath is incomplete or wrong.


Thankyou for all of your help. I did some more fiddling with commands and the following worked:

java -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar:/home/richard/" -Djava.library.path="/usr/lib/gluegen/:/usr/lib/jogl/" JOGLTetrahedron

The equal sign in -Djava.library.path="/usr/lib/gluegen/:/usr/lib/jogl/" turned out to be necessary. Without it, the java runtime thought that "/usr/lib/gluegen/:/usr/lib/jogl/" was my class name, yet it will give an unrecongized option error when an equal sign is used with the classpath option.

What is unfortunate, is that I had tried this command several times in the past, but it did not work because the equal sign was missing. Java's commandline interface is very well designed, is it not? :/

Edit: Now I am trying to get the JOGL demos to run and it seems that they keep failing:

Quote:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.javaws.Launcher.executeApplication(Launcher.java:1749)
at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1695)
at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1477)
at com.sun.javaws.Launcher.run(Launcher.java:129)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.UnsatisfiedLinkError: no gluegen-rt in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at com.sun.gluegen.runtime.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:102)
at com.sun.gluegen.runtime.NativeLibLoader.access$000(NativeLibLoader.java:51)
at com.sun.gluegen.runtime.NativeLibLoader$1.run(NativeLibLoader.java:70)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.gluegen.runtime.NativeLibLoader.loadGlueGenRT(NativeLibLoader.java:68)
at com.sun.gluegen.runtime.NativeLibrary.ensureNativeLibLoaded(NativeLibrary.java:399)
at com.sun.gluegen.runtime.NativeLibrary.open(NativeLibrary.java:163)
at com.sun.gluegen.runtime.NativeLibrary.open(NativeLibrary.java:129)
at com.sun.opengl.impl.x11.DRIHack.begin(DRIHack.java:109)
at com.sun.opengl.impl.x11.X11GLDrawableFactory.<clinit>(X11GLDrawableFactory.java:99)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:111)
at javax.media.opengl.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:520)
at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:131)
at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:90)
at terrain.DBFlyer.run(DBFlyer.java:75)
at terrain.JCanyonWebStart.main(JCanyonWebStart.java:236)
... 9 more


https://jogl-demos.dev.java.net/

Runescape, which I believe also uses JOGL, keeps telling me to upgrade my version of Java. This is despite having added -classpath "/usr/share/jogl/lib/jogl.jar:/usr/share/gluegen/lib/gluegen-rt.jar" -Djava.library.path="/usr/lib/gluegen/:/usr/lib/jogl/" to my runtime parameters in ControlPanel. :/
Back to top
View user's profile Send private message
Shining Arcanine
Veteran
Veteran


Joined: 24 Sep 2009
Posts: 1110

PostPosted: Fri May 14, 2010 7:21 pm    Post subject: Reply with quote

I did not do a thing after modifying the ControlPanel settings and JGOL magically started working in runescape. I guess some cache on the system had to be updated before the changes I made in ControlPanel were reflected.
Back to top
View user's profile Send private message
gouessej
n00b
n00b


Joined: 02 Aug 2011
Posts: 1

PostPosted: Tue Aug 02, 2011 2:35 pm    Post subject: Reply with quote

Hi

Sorry to resurrect this old thread. JOGL is no more on jogl.dev.java.net, it is now developed by the JogAmp foundation and is located here:
http://jogamp.org/

The error you got with Runescape can happen if an old version of JOGL has been copied directly in the JVM. Maybe reinstall Java or at least clean the cache of Java Web Start.

If you have any question about JOGL, rather ask them on the official forum or on http://www.java-gaming.org.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum