TheMineral
TheMineral

Reputation: 63

Running OpenGL commands in a java program

I am trying to run a Java program that contains OpenGL commands, and it does compile. I am using netbeans and have added the necessary librarys.

But i get this:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jogl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at com.sun.opengl.impl.NativeLibLoader$1.run(NativeLibLoader.java:111)
etc etc etc.

think it may be something with path, but nothing works-

Upvotes: 0

Views: 806

Answers (1)

Goblin Alchemist
Goblin Alchemist

Reputation: 827

To use JOGL, the program needs JOGL JAR files and JOGL native libraries (e.g. DLL files on Windows). Your stack trace indicates that native libraries are not found. The way Java searches native libraries is system-dependent, but on Windows you have several options to get the JOGL native libraries loaded:

  • Place the native libraries into a folder referenced in the Windows PATH variable;
  • I recall there is a dedicated subfolder in the JRE installation folder which can also be used for native libraries;
  • Add the folder with the native libraries to the Windows PATH variable;
  • Specify the folder with the native libraries in the -Djava.library.path parameter when running java.exe;
  • Set the folder with the native libraries as the current folder before running java.exe.

The first three options may require administrator privileges. For some reason, I did not get the fourth option working. So, my JOGL application uses the fifth option and it works fine.

Upvotes: 3

Related Questions