0

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:

  1. Downloaded this
  2. Moved all of these files into their own folder(called JOGL):
    • gluegen-rt.jar
    • jogl-all.jar
    • gluegen-java-src.zip
    • jogl-java-src.zip
    • gluegen-rt.dll
    • jogl_desktop.dll
    • nativewindow_awt.dll
    • nativewindow_win32.dll
    • newt.dll
  3. Went to Project structure and added the JOGL folder to the module as a library
  4. Attempted to run the module with the import: import net.java.games.jogl.*; added

I 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.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
Brad
  • 171
  • 5
  • 15
  • Edit the post with the actual errors that you get. Does it compile? Does it fail when running? With what errors? Attach a screenshot with the [dependencies configuration](http://www.jetbrains.com/idea/webhelp/configuring-module-dependencies-and-libraries.html). – CrazyCoder Apr 21 '13 at 10:25

2 Answers2

2

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.

samael
  • 2,007
  • 1
  • 16
  • 34
  • Does this still work? I am trying right now and it doesn't seem to work. Are you sure that is _everything_ you need to do? – Ciro García Jun 22 '21 at 07:06
  • There are more recent versions now but essentially yes. You'll need to establish which dependencies you need (top 2 certainly), then as with any maven project, add them in and have maven download them. https://jogamp.org/wiki/index.php/Maven – samael Jun 25 '21 at 13:48
1

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.

gouessej
  • 3,640
  • 3
  • 33
  • 67