Linux Error

Redhat 9

export PATH=$PATH:/usr/java/j2sdk1.4.2/bin:/usr/java/j2sdk1.4.2/jre/lib/ext
export CLASSPATH=.:/usr/java/j2sdk1.4.2/jre/lib/ext/jogl.jar

[root@localhost test]# java Gears
Exception in thread “main” java.lang.UnsatisfiedLinkError: no jogl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at net.java.games.jogl.impl.NativeLibLoader$1.run(NativeLibLoader.java:60)
at java.security.AccessController.doPrivileged(Native Method)
at net.java.games.jogl.impl.NativeLibLoader.(NativeLibLoader.java:46)
at net.java.games.jogl.impl.GLContext.(GLContext.java:51)
at net.java.games.jogl.impl.x11.X11GLContextFactory.createGLContext(X11GLContextFactory.java:52)
at net.java.games.jogl.GLCanvas.(GLCanvas.java:72)
at net.java.games.jogl.GLDrawableFactory.createGLCanvas(GLDrawableFactory.java:117)
at net.java.games.jogl.GLDrawableFactory.createGLCanvas(GLDrawableFactory.java:80)
at Gears.main(Gears.java:16)

You need to point java to the jogl.so

java -Djava.library.path=/location/of/jogl.so Gears.

EDIT: It’s actually libjogl.so not jogl.so my bad.

Hi.

some Linux tipps:
[] No need to include the ext directory in $PATH or $CLASSPATH.
[
] your native library must be called libjogl.so
[*] the directory where libjogl.so lies needs to be listed in java.library.path
You can also set the environment variable LD_LIBRARY_PATH to include the directory where your shared library is located. The dynamic linker will look for this variable and include the shared libs found there.

Thanks guys, finally I could run Gears.java in linux! Is a good graphics card really needed for jogl to work in Linux properly??

I tried porting my application over to linux but faced the following error which was non-existence in windows xp

[b]An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x4CD5C437
Function=XVisualIDFromVisual+0x7
Library=/usr/X11R6/lib/libX11.so.6

Current Java thread:
at net.java.games.jogl.impl.JAWT_DrawingSurface.GetDrawingSurfaceInfo0(Native Method)
at net.java.games.jogl.impl.JAWT_DrawingSurface.GetDrawingSurfaceInfo(JAWT_DrawingSurface.java:42)
at net.java.games.jogl.impl.x11.X11OnscreenGLContext.lockSurface(X11OnscreenGLContext.java:167)
at net.java.games.jogl.impl.x11.X11OnscreenGLContext.makeCurrent(X11OnscreenGLContext.java:108)
- locked <0x44487ad8> (a net.java.games.jogl.impl.x11.X11OnscreenGLContext)
at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:162)
- locked <0x44487ad8> (a net.java.games.jogl.impl.x11.X11OnscreenGLContext)
at net.java.games.jogl.GLCanvas.reshape(GLCanvas.java:119)
at java.awt.Component.setBounds(Component.java:1665)
at java.awt.BorderLayout.layoutContainer(BorderLayout.java:683)
- locked <0x448f2d00> (a java.awt.Component$AWTTreeLock)
at java.awt.Container.layout(Container.java:1017)
at java.awt.Container.doLayout(Container.java:1007)
at java.awt.Container.validateTree(Container.java:1089)
at java.awt.Container.validate(Container.java:1064)
- locked <0x448f2d00> (a java.awt.Component$AWTTreeLock)
at java.awt.Window.pack(Window.java:438)
at cube.(cube.java:164)
at cube.main(cube.java:440)[/b]

I used a GLCanvas, placing it in a JFrame


final Container c = getContentPane();
c.setLayout(new BorderLayout());

glc = GLDrawableFactory.getFactory().createGLCanvas(cap);
glc.setSize(640,480);
glc.requestFocus();
glc.addGLEventListener(view);

// Add the Component into the window
c.add( "Center", glc );
pack(); show();


I believe this is because a problem with mixing heavyweight components (GLCanvas) and lightweight (JFrame).

It should :wink: work if you change to either using a Frame with GLCanvas or using GLJCanvas (?name?) with a JFrame.

Probably something like


GLDrawableFactory.getFactory().createGLJCanvas(cap);