Reputation: 301
I've looked around and I can't seem to figure this out. I'm trying to setup JOGL(on win64) for use with IntelliJ IDEA and it doesn't seem to work no matter what I do. Here's what I've done so far:
import net.java.games.jogl.*;
addedI also attempted to run the line of code System.loadLibrary("jogl");
without using the import, and it didn't work. Any help is appreciated.
These are the guides I was following:
Edit:
As per CrazyCoder's request, when I attempt to compile with the import net.java.games.jogl.*;
that I mentioned, I get:
java: C:\....\Main.java:2: package net.java.games.jogl does not exist
When I remove the import and attempt to run it with the System.loadLibrary("jogl");
line inserted, I get:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jogl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at core.Main.main(Main.java:15)
Strangely, when I try to run it on the command line with the command java -cp "/cygdrive/c/apps/JOGL/" core.Main
I get:
java.lang.NoClassDefFoundError: core/Main
Caused by: java.lang.ClassNotFoundException: core.Main
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:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: core.Main. Program will exit.
Exception in thread "main"
Where if I don't run it with the -cp "/cygdrive/c/apps/JOGL/"
, it works fine (as in, actually runs and gives me the same results as the IDE, but also fails in the same ways).
Below is a screenshot of my module's dependencies(JOGL is what I mentioned it was above):
I tried to separate everything to make it more readable, sorry if it's difficult to follow.
Upvotes: 1
Views: 8630
Reputation: 4105
Just put jogl-all.jar and gluegen-rt.jar into your classpath and put the JARs containing the native libraries into the same directory. net.java.games.jogl comes from JOGL JSR 231 (an extremely old version) which isn't maintained anymore whereas you downloaded JOGL 2. Adapt your code to make it work with JOGL 2.
Edit.: Now you can use a single JAR, jogamp-far.jar. Just put it into your classpath and it works. It's a lot easier. The instructions are in our wiki.
Edit. (2024): The package namespaces "net.java.games" and "javax.media" have no longer been used in JOGL 2 for many years, rather use "com.jogamp": https://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/index.html?overview-summary.html
Upvotes: 0
Reputation: 2178
If you're using IDEA it would make sense to do this as a maven project since IDEA has great maven support. Just paste the dependencies into your pom.xml
they are available from maven central:
<dependencies>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt-main</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all-main</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.jogamp.jocl</groupId>
<artifactId>jocl</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.jogamp.jocl</groupId>
<artifactId>jocl-main</artifactId>
<version>2.0.2</version>
</dependency>
<!-- audio -->
<dependency>
<groupId>org.jogamp.joal</groupId>
<artifactId>joal</artifactId>
<version>2.0.2</version>
</dependency>
</dependencies>
This is what I use when playing with JOGL and it works a treat.
Upvotes: 1