Other problem in running some java programs

Hello!
I trying to compile some java programs that using JOGL (Java Binding for OpenGL)
I successfully compiled this but I cannot run this:
Code:
% javac -cp '/usr/local/share/java/classes/jogl2.jar:./:/usr/local/share/java/classes/gluegen2-rt.jar' HelloTriangleSimple.java
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp
% java -cp '/usr/local/share/java/classes/jogl2.jar:./:/usr/local/share/java/classes/gluegen2-rt.jar' -Djava.library.path=/usr/local/lib HelloTriangleSimple
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp
Error: Could not find or load main class HelloTriangleSimple

Code:
% java -version
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp
openjdk version "1.8.0_452"
OpenJDK Runtime Environment (build 1.8.0_452-b09)
OpenJDK 64-Bit Server VM (build 25.452-b09, mixed mode)

I tried https://jogamp.org/wiki/index.php?title=Using_JOGL_in_AWT_SWT_and_Swing with same error in running.
 
Hi, now that is funny b/c I just created an account here and I am the maintainer of JogAmp :)

In your example, maybe you need to set the classpath to current directory as well, i.e. just `.` not `./`?
I haven't tested with openjdk8 for a long time myself - but it should work.

+++

For release 2.6.0 I just added FreeBSD and I use openjdk21 or openjdk24, see my setup recipe.

Here is my little bring-up description using the fat-jar w/o the need for native libraries.

Code:
#!/bin/sh

type=archive/rc
version=v2.6.0
folder=${type}/${version}

mkdir ${version}
cd ${version}

curl --silent --output jogamp-fat.jar  https://jogamp.org/deployment/${folder}/fat/jogamp-fat.jar
curl --silent --output jogl-demos.jar https://jogamp.org/deployment/${folder}/fat/jogl-demos.jar
curl --silent --output jogl-fonts-p0.jar https://jogamp.org/deployment/${folder}/fat/jogl-fonts-p0.jar

echo "Fetched from ${folder} to ${version}"

java -cp jogamp-fat.jar:jogl-demos.jar com.jogamp.opengl.demos.graph.ui.UISceneDemo03

Hope it helps.
 
Thank you jaubits I managed to run program with jogl 1.1 (not tried yet with jogl 2.x) but I had forgotten to update this thread.
for jogl 1.1 I forgotten to add current directory to classpath.
sh:
java -cp /usr/local/share/java/classes/jogl.jar:/usr/local/share/java/classes/gluegen-rt.jar:./ <MainClassName>
Now program (using jogl 1.1) running without problem.
 
I tried again this with jogl 2.3.2 (binary pkg jogamp-jogl):
sh:
:% javac -cp /usr/local/share/java/classes/jogl2.jar:/usr/local/share/java/classes/gluegen2-rt.jar OneTriangle.java
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp
% javac -cp /usr/local/share/java/classes/jogl2.jar:/usr/local/share/java/classes/gluegen2-rt.jar:./ OneTriangleSwingGLCanvas.java
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp

% java -cp /usr/local/share/java/classes/jogl2.jar:/usr/local/share/java/classes/gluegen2-rt.jar:./ OneTriangleSwingGLCanvas
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp
Exception in thread "AWT-EventQueue-0" com.jogamp.opengl.GLException: Profile GL4bc is not available on X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x29afa468b800, owner true, JAWTToolkitLock[obj 0x4552b31d, isOwner true, <b48a4d8, 7aa42981>[count 1, qsz 0, owner <AWT-EventQueue-0>]]], but: [GLProfile[GLES1/GLES1.hw], GLProfile[GLES2/GLES3.hw], GLProfile[GL2ES1/GLES1.hw], GLProfile[GL4ES3/GL4.hw], GLProfile[GL2ES2/GL4.hw], GLProfile[GL4/GL4.hw], GLProfile[GLES3/GLES3.hw], GLProfile[GL4/GL4.hw], GLProfile[GL3/GL4.hw], GLProfile[GL2GL3/GL4.hw]]
.......

I tried AWT example with same result (exception occurred after window shown)
I think I should set GLProfile manually but I don't know how.
 
--enable-native-access=ALL-UNNAMED --add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.awt.windows=ALL-UNNAMED --add-opens j
ava.desktop/sun.java2d=ALL-UNNAMED

In case you use openjdk >= 17, these are the required JVM arguments.
The AWT related ones only if using AWT,
The first JNI lib loading argument only required for openjdk >= 21 to my memory.

If the above is missing on a 'new' JVM, JOGL simply has no access to utilize the AWT details etc.
Sorry, the wiki is a little bit out of date and not fully covering all the 'recent' JVM changes.
 
java and dotnet can be buggy when compared to linux.

I never touched dotnet, but I can't agree with you about java.

--enable-native-access=ALL-UNNAMED --add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.awt.windows=ALL-UNNAMED --add-opens j
ava.desktop/sun.java2d=ALL-UNNAMED

In case you use openjdk >= 17, these are the required JVM arguments.
The AWT related ones only if using AWT,
The first JNI lib loading argument only required for openjdk >= 21 to my memory.

If the above is missing on a 'new' JVM, JOGL simply has no access to utilize the AWT details etc.
Sorry, the wiki is a little bit out of date and not fully covering all the 'recent' JVM changes.

I still use openjdk8, still I need them to run program?
The problem isn't related to GLProfile?

Edit:
I changed OneTriangleAWT example to use GLES2 (replace GL2 with GLES2 and remove glVertex, glBegin etc. and set GLProfile as well) now program running (clears the screen with black color) without problem.
 
Hi, now that is funny b/c I just created an account here and I am the maintainer of JogAmp :)

Any suggestions about using a libgluegen2-rt.so symlink? It looks like jogl-amp isn't available on 15.0, and jogl-1.1.1_10's .so didn't seem to work.


I tried using fat jars but don't quite know if I had the flags right or if it didn't work.

I built the project using openjdk8 mainly for the jogl-amp package being convenient, but the project builds and runs 17-24. One idea is if I could build libgluegen2-rt.so from upstream, then just drop it in the folder like I did with one from jogl-amp's pkg? Is there a prebuilt I could use?
 
Back
Top