Can't compile with JOGL (not a NOOB, JAVA = piss)

Ok, i’m highly experienced with OpenGL & C++… (Windows btw)

I only have a moderate knowledge of Java (mainly with GUIs) and am trying to basically set up JOGL.
I read various bits & bobs including the article here but it isn’t detailed enough.

Could somebody just give a step by step of what i’m supposed to do. Java is pissy like this.

Put .jar here, do this, etc.

easiest way to get up and running is the following:
Find the JDK you’re using as your development JDK (check out the path environment var from the command line or the JAVA_HOME var). Unjar the two native DLL’s that come with JOGL and put them into the jdk/bin directory. Then put the JOGL.jar file into the jdk/jre/lib/ext directory.

that should do the trick.

D.

Or using Eclipse for example you could just add the jogl.jar as an External JAR to your project and add

-Djava.library.path=/path/to/native/libs

to the VM Arguments in the Run… dialog (after having unjarred the native libs to that directory of course). Other IDEs will probably have similar options available.

Not saying this is the easiest way because the way Daire explained will work for all projects and all IDEs but maybe you just don’t want to “pollute” your JDK environment yet with JARs and native libs yet.

PS: I would have to do something similar for C++ (even in Visual Studio on Windows) so I don’t understand why you’re so pissed off with Java :wink:

I have so may JDKs, JOGL and LWJGL versions in my machine but following “my” principal makes it smooth using any version I like while testing this and that.

  1. Create RunForrestRun.bat batch to launch a program
  2. Set JOGL and CP env vars at the start of batch
  3. Set java.exe command to launch an app

Key is to give “-Djava.library.path=c:/jnidllfolder” so that virtual machine can find a native .dll files. Then use -classpath (or-cp) to give .jar files and classes folders.

I sort of create a temporary system32 path for each application launch. Now I can mix various JDKs and JOGL versions easily just creating a new testappJDK1.5.bat file.

This is how folders and files might look:
c:/projects/java/jogl/jogl-win32/jogl.dll
c:/projects/java/jogl/jogl-win32/jogl_cg.dll
c:/projects/java/jogl/jogl-win32/jogl.jar
c:/projects/java/testapp/RunMyApp.bat
c:/projects/java/testapp/lib/mytestapp.jar
c:/projects/java/testapp/lib/anotherLib.jar
c:/projects/java/testapp/src/.java
c:/projects/java/testapp/classes/
.class

If you use some Java IDE then create a project and add jog.jar to a library list. dll files are not required for the compilation, just running the app needs it.

RunMyApp.bat


SET jogl=C:/projects/java/jogl/jogl-win32
SET cp=%jogl%/jogl.jar

SET jnilib=%jogl%;./otherJNIDLLfolder
SET cp=%cp%;./lib/myapp.jar;./lib/otherJavaLib.jar;c:/utils/classes

rem c:\j2sdk1.4.2_04\bin\java.exe -Djava.library.path=%jnilib% -cp %cp% AppDemo

java.exe -Djava.library.path=%jnilib% -cp %cp% AppDemo

pause

yeah, thats probably the best way to do it. However Ultimo couldn’t get it working following the instructions in the ‘getting started in JOGL’ sticky, so the way i suggested gets him/her up and running without too much difficulty. Ordinarily when people new to java can’t get stuff to compile/run my advice would be to check the classpath. If it still doesn’t work then check the classpath. if it STILL doesn’t work, then check the classpath. JOGL adds the complication of native librarys to the mix aswell so when you tell them to check the java.library.path normally the response is a baffled one.

D.

true, very true. Even most long time Java coders dont know what is a “java.library.path” setting. Most java coders does not have to use an external native dll libraries, just ordinary .jar libraries.

Only lwjgl/jogl type of library users must know how to give a proper “java.library.path” setting when running a program.

Eesiest is of course your advise copying files to jre/bin, jdk/bin or to win/system32 folders like older windows programs do. But we Java coders dont want to pollute system32 folder, so never do it.

Here is my general purpose JavaDOS project example. Use it as a template for “pure dos java ide”.
http://koti.mbnet.fi/akini/java/dosproject/

and dont forget MANIFEST.MF file. So many, read most :’( , just don’t use it properly. Even jogl.jar does not have a proper manifest file. Always give a version and title information.