Help installing JOGL

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Help installing JOGL

Baltar
Hello,

I am new to Java programming, and I am interested in learning how to use JOGL.

Unfortunately, I do not understand how to 'install' jogl onto my system (if 'install' is the appropriate verb here). After reading the installation tutorial, I think I understand that I need to download the appropriate version, unzip the files, and then copy each file into an appropriate folder. However, I currently do not understand precisely which files must be moved into which folders (specifically).

Can someone help me?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Help installing JOGL

Wade Walker
Administrator
Hi Baltar,

You might try the tutorial at http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE. It covers JOGL "installation" (really just unzipping, as you mentioned) as part of how to set up a JOGL project in various ways.

JOGL doesn't have to be in any particular folder, so long as your code can find it at runtime. I usually put it either inside my program's project folder, or in a parallel project folder. For example, if you get the latest autobuild from http://jogamp.org/deployment/autobuilds/master/jogl-b436-2011-08-30_12-55-58/ and unzip it, you can just copy its "jar" and "lib" folders to somewhere inside your project folder.
Reply | Threaded
Open this post in threaded view
|

Re: Help installing JOGL

Baltar
Thanks a lot! :)
Reply | Threaded
Open this post in threaded view
|

Re: Help installing JOGL

Penny
Hi,

Although I have been programming Java for years I cant seem to figure out this problem...

I have copied all the jar files to "C:\Program Files\Java\jogl"

I have set the environment variable CLASSPATH to

.;C:\Program Files\Java\jogl\jar\gluegen.jar;C:\Program Files\Java\jogl\jar\gluegen-rt.jar;C:\Program Files\Java\jogl\jar\joal.jar;C:\Program Files\Java\jogl\jar\jocl.jar;C:\Program Files\Java\jogl\jar\jogl-all.jar;

I can now compile my code using javac.exe

GREAT! :)

My problem is I get the error ClassDefNotFound

I have tried the following command line...

"C:\Program Files\Java\jdk1.7.0_11\bin\javaw.exe" -jar MyProgram.jar

"C:\Program Files\Java\jdk1.7.0_11\bin\javaw.exe" -classpath "C:\Program Files\Java\jogl\jar\gluegen-rt.jar;C:\Program Files\Java\jogl\jar\jogl-all.jar" -jar MyProgram.jar

Nothing seems to work. I have even tried copying the jars and dlls into the bin and lib directories of jre7 and within the jre of jdk but yet still no oochachar

Please advise, many thanks :)
Reply | Threaded
Open this post in threaded view
|

Re: Help installing JOGL

Sven Gothel
Administrator
On 01/29/2013 05:58 PM, Penny [via jogamp] wrote:
> Hi,
>
> Although I have been programming Java for years I cant seem to figure out this
> problem...
>
> I have copied all the jar files to "C:\Program Files\Java\jogl"
incl. all the *native* jar files I assume ?

>
> I have set the environment variable CLASSPATH to
>
> .;C:\Program Files\Java\jogl\jar\gluegen.jar;C:\Program
> Files\Java\jogl\jar\gluegen-rt.jar;C:\Program
> Files\Java\jogl\jar\joal.jar;C:\Program
> Files\Java\jogl\jar\jocl.jar;C:\Program Files\Java\jogl\jar\jogl-all.jar;
>
> I can now compile my code using javac.exe
>
> GREAT! :)
>
> My problem is I get the error ClassDefNotFound
pls be more specific (full stderr dump)

>
> I have tried the following command line...
>
> "C:\Program Files\Java\jdk1.7.0_11\bin\javaw.exe" -jar MyProgram.jar
>
> "C:\Program Files\Java\jdk1.7.0_11\bin\javaw.exe" -classpath "C:\Program
> Files\Java\jogl\jar\gluegen-rt.jar;C:\Program
> Files\Java\jogl\jar\jogl-all.jar" -jar MyProgram.jar

should work though .., e.g.:

  set CLASSPATH=".;gluegen-rt.jar;jogl-all.jar;"

Maybe it's your start method using the '-jar' notation.
I have to admit I rarely test this.
AFAIK you have to reference the other JAR files
in your manifest, where you name your main-class.

However, 'java -cp YOUR_CLASSPATH my.main.Class"
should work.

>
> Nothing seems to work. I have even tried copying the jars and dlls into the
> bin and lib directories of jre7 and within the jre of jdk but yet still no
> oochachar

don't do that :)

>
> Please advise, many thanks :)

~Sven



signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Help installing JOGL

Penny
Thanks very much for your speedy reply.

I can confirm that joglamp-all-platforms.7z contents of the 1st directory reside in C:\Program Files\Jave\jogl
I have removed all other instances of the files.

My classpath is...

CLASSPATH=".;C:\Program Files\Java\jogl\jar\gluegen-rt.jar;C:\Program Files\Java\jogl\jar\jogl-all.jar;"


My command line command is...
"C:\Program Files\Java\jdk1.7.0_11\bin\javaw.exe" -cp ".;C:\Program Files\Java\jogl\jar\gluegen-rt.jar;C:\Program Files\Java\jogl\jar\jogl-all.jar" -jar MyProgram.jar

It compiles ok, but I am still at a guess as to how to have the jars included during runtime. "java.lang.NoClassDefFoundError: javax/media/opengl/GLProfile"

I have looked at lots of install instructions and I am still at a loss as to what the problem is.

Your help is greatly appreciated Thanks :)
Reply | Threaded
Open this post in threaded view
|

Re: Help installing JOGL

Penny
theres about 40 jar files with "native" in the name in "C:\Program Files\Java\jogl\jar" exactly as the 7z file.

not sure how to get a stderr output but I can provide you with the error stack trace...

========================================
SENTINEL [main]:Tue Jan 29 18:42:18 GMT 2013
 java.lang.NoClassDefFoundError: javax/media/opengl/GLProfile
  a.Test.init(11)
   a.MyProgram.init(28)
    a.MyProgram.main(47)
========================================
Reply | Threaded
Open this post in threaded view
|

Re: Help installing JOGL

Xerxes Rånby
This post was updated on .
In reply to this post by Penny
Penny wrote
My command line command is...
"C:\Program Files\Java\jdk1.7.0_11\bin\javaw.exe" -cp ".;C:\Program Files\Java\jogl\jar\gluegen-rt.jar;C:\Program Files\Java\jogl\jar\jogl-all.jar" -jar MyProgram.jar

It compiles ok, but I am still at a guess as to how to have the jars included during runtime. "java.lang.NoClassDefFoundError: javax/media/opengl/GLProfile"
It is not possible to combine the CLASSPATH -classpath/-cp option with -jar the command line option.

Jar deployment
When you specify -jar expects all jars to be located according to the manifest file inside the main jar.
The -jar switch indicate that only the MyProgram.jar -> META-INF/MANIFEST.MF -> Class-Path: entry will be in use.
You need to add the gluegen-rt.jar and jogl-all.jar to the Class-Path: entry then -jar will work.
Usually java IDE such as Netbeans and Eclipse generate a correct MANIFEST.MF when you build or export your application.

With a correct MANIFEST.MF allows you to start your application using:
java -jar MyProgram.jar

External documentation for Jar deployment
http://en.wikipedia.org/wiki/Classpath_%28Java%29#Setting_the_path_in_a_Manifest_file
http://docs.oracle.com/javase/tutorial/deployment/jar/downman.html

I can give you an example what a correct MANIFEST.MF can look like:
Directory structure:
pax.jar
pax_lib -> contains all JogAmp jars gluegen-rt.jar jogl-all.jar joal.jar and all the native jars.
pax.jar -> META-INF/MANIFEST.MF
Manifest-Version: 1.0
Class-Path: . pax_lib/gdx-natives.jar pax_lib/javaparser-1.0.8.jar pax_lib/gluegen-rt.jar pax_lib/jorbis.jar pax_lib/jogl-all.jar pax_lib/joal.jar pax_lib/jlayer-1.0.1-libgdx.jar
Main-Class: de.swagner.paxbritannica.PaxBritannicaDesktop

Note that the Class-Path: entry always uses / to separate directory’s and blanks to separate jars.

Classpath deployment using CLASSPATH -cp or -classpath option
You can always run your application by specifying all jars including your MyProgram.jar using -classpath and then specify your MainClass.
java -classpath "MyProgram.jar;gluegen-rt.jar;jogl-all.jar;." MainClass

The command line is different for windows and linux deployment,
windows uses ; to separate jars while linux uses :
windows uses \ to specify directory separator while linux uses /

Reply | Threaded
Open this post in threaded view
|

Re: Help installing JOGL

Penny
Thanks very much for your help!!! :D

I can now run jogl using the command line.

I created a manifest file that contains Class-Path: and paths going to gluegen-rt.jar and jogl-all.jar
This works as expected but when I specified additional jars gluegen.jar jocl.jar and joal.jar I received the following error...

========================================
SENTINEL [main]:Wed Jan 30 13:49:25 GMT 2013
 java.lang.UnsatisfiedLinkError: no gluegen-rt in java.library.path
  java.lang.ClassLoader.loadLibrary(1860)
   java.lang.Runtime.loadLibrary0(845)
    java.lang.System.loadLibrary(1084)
     com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(442)
      com.jogamp.common.jvm.JNILibLoaderBase.access$000(59)
       com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(90)
        com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(328)
         com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(390)
          com.jogamp.common.os.Platform.loadGlueGenRTImpl(251)
           com.jogamp.common.os.Platform.access$000(57)
            com.jogamp.common.os.Platform$1.run(186)
             com.jogamp.common.os.Platform$1.run(183)
              com.jogamp.common.os.Platform.<clinit>(183)
               javax.media.opengl.GLProfile.<clinit>(82)
                a.Test.init(11)
                 a.MyProgram.init(28)
                  a.MyProgram.main(47)
========================================

Im very happy I have jogl working from the command line.

I now turn to running jogl using the same but invoked from a browser.

Using the following tag in my html my signed jar program works as expected.
<applet archive=myProgram.jar code=a/MyProgram.class width=100% height=100%>

But I receive the error
SecurityException
attempted to open sandboxed jar file:/D:/jogl2/jar/jogl-all.jar as a Trusted-Library

My signed jar is working as I am allowed access to the system clipboard.

Any ideas please
Many Thanks
P
Reply | Threaded
Open this post in threaded view
|

Re: Help installing JOGL

Penny
If my project is to be rolled out to users who do not have jogl installed what would be the best method of implementation?

Maybe I could write a routine that checks for the jars on their hard drive and if not located automatically install them?

Downloading the jars seems a bit impractical.

Regards
P
Reply | Threaded
Open this post in threaded view
|

Re: Help installing JOGL

Penny
My last sentence should read...

Downloading the jogl jars every time the project is invoked by a user seems a bit impractical.
Reply | Threaded
Open this post in threaded view
|

Re: Help installing JOGL

gouessej
Administrator
Why not using Java Web Start? If the JARs have not changed, they won't be downloaded. Don't write your own routines to check if the native libraries are already on the hard drive because you would have to modify the Java library path to load them and you would have to check if this is the good version of the native libraries. Such a solution is useless and complicated.

Edit.: you can use JNLP in applets too. You can point to JOGL as an extension and use our JARs or deploy them on your server.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Help installing JOGL

Penny
Hiya,
I didnt realise Java Web Start runs within a browser like an applet. I will look into it.
Thanks
P
Reply | Threaded
Open this post in threaded view
|

Re: Help installing JOGL

gouessej
Administrator
You can use JNLP both in a standalone application you launch from the web browser or your desktop and in an applet that runs within a web browser. The first solution is generally more reliable.

Edit.: Look at jnlp_ref to use a JNLP file in an applet.
Julien Gouesse | Personal blog | Website