Re: JOGL 2.3.2 example compiles but fails to run (Maven 3.8.2, NetBeans 12.4, OpenJDK 16.0.2, Lubuntu 21.10)
Posted by neblaz on Sep 05, 2021; 6:59pm
URL: https://forum.jogamp.org/JOGL-2-3-2-example-compiles-but-fails-to-run-Maven-3-8-2-NetBeans-12-4-OpenJDK-16-0-2-Lubuntu-21-10-tp4041246p4041259.html
Yes, I know that on such projects volunteers are involved.
I think the fat jar is not only a quick way but a very simple way for beginners with JOGL like me.
Well, I'm used to Maven, Gradle not really.
Adding the fat jar to classpath in NetBeans, OK will try that, never before, allways every dependency via pom.xml
By the way, how to add jogamp-fat.jar into classpath of NetBeans Maven project?
When I create a Java with Ant project, and add the jogamp-far.jar to Libraries, it functions immediately from within NetBeans 12.4
Why is it such a problem with a Java with Maven project to add local jar files?
I tried again to add to pom.xml just to have the one local dependency:
<dependencies>
<dependency>
<groupId>org.jogamp</groupId>
<artifactId>jogamp-fat</artifactId>
<version>2.4.0</version>
<scope>system</scope>
<systemPath>/home/me/PROGRAMs/JOGL/jogamp-fat/jogamp-fat.jar</systemPath>
</dependency>
</dependencies>
It compiles, but Run File show following error:
cd /home/me/NetBeansProjects/JOGLsecond; JAVA_HOME=/home/me/PROGRAMs/openjdk-16.0.2 M2_HOME=/home/me/PROGRAMs/apache-maven-3.8.2 /home/me/PROGRAMs/apache-maven-3.8.2/bin/mvn -Dexec.vmArgs= "-Dexec.args=${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}" -Dexec.executable=/home/me/PROGRAMs/openjdk-16.0.2/bin/java -Dexec.mainClass=com.mycompany.joglsecond.RawGL2ES2demo -Dexec.classpathScope=runtime -DskipTests=true -Dexec.appArgs= org.codehaus.mojo:exec-maven-plugin:3.0.0:exec
Running NetBeans Compile On Save execution. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts.
Scanning for projects...
Some problems were encountered while building the effective model for com.mycompany:JOGLsecond:jar:1.0-SNAPSHOT
'dependencies.dependency.systemPath' for org.jogamp:jogamp-fat:jar should use a variable instead of a hard-coded path /home/me/PROGRAMs/JOGL/jogamp-fat/jogamp-fat.jar @ line 20, column 25
It is highly recommended to fix these problems because they threaten the stability of your build.
For this reason, future Maven versions might no longer support building such malformed projects.
----------------------< com.mycompany:JOGLsecond >----------------------
Building JOGLsecond 1.0-SNAPSHOT
--------------------------------[ jar ]---------------------------------
--- exec-maven-plugin:3.0.0:exec (default-cli) @ JOGLsecond ---
Error: Could not find or load main class com.mycompany.joglsecond.RawGL2ES2demo
Caused by: java.lang.NoClassDefFoundError: com/jogamp/opengl/GLEventListener
...
Is it because Maven complains now to use a variable or some other problem?