cant compile a jogl application

i have been trying to get my hands on jogl and found the tutorial at http://www.cs.umd.edu/~meesh/kmconroy/JOGLTutorial/

i cant compile the first example, the error is mainly the not existence of the packages:
import net.java.games.jogl.GLCanvas;
import net.java.games.jogl.GLCapabilities;
import net.java.games.jogl.GLDrawableFactory;

i have changed them to javax.media.opengl.GLCanvas (after extracting some the jogl jar in an irrelevant directory and skimming it in order to find the GLCanvas class, i found the javax.media.opengl folder hierarchy )but didnt help

also i have changed the CLASSPATH and Path variables acording to the instructions of the UserGuide.html included in the zip i downloaded from the official jogl site…
(that means i hava the C:\Jogl\lib folder with the files and i have added in the CLASSPATH two values the ;C:\Jogl\lib\gluegen-rt.jar;C:\Jogl\lib\jogl.jar without any ,.; or something at the end and in the Path variable (not PATH if it makes any difference) i added one value ;C:\Jogl\lib without any ,.; in the end)

i have to mention that the jogl demos from the official site fail to launch as well… (https://jogl-demos.dev.java.net/ the message is “Unable to launch application” i clicked on details a two tabbed frame appeared, the first was named Launch File and the content was

<?xml version="1.0" encoding="utf-8"?>



JOGL Gears Demo
Sun Microsystems, Inc.

Gears Demo
Brian Paul’s Gears demo ported to Java and JOGL.

<resources>
  <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/>
  <property name="sun.java2d.noddraw" value="true"/>
  <jar href="jogl-demos.jar" main="true"/>
  <jar href="jogl-demos-util.jar" />
  <extension name="jogl-all-awt" href="http://download.java.net/media/jogl/jsr-231-2.x-webstart/jogl-all-awt.jnlp" />
</resources>

and the second was named Exception and the content was

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoSuchMethodError: com.sun.gluegen.runtime.BufferFactory.nativeOrder(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;
at com.sun.nativewindow.impl.jawt.JAWT.GetDrawingSurface(JAWT.java:54)
at com.sun.nativewindow.impl.jawt.windows.WindowsJAWTWindow.lockSurface(WindowsJAWTWindow.java:69)
at com.sun.opengl.impl.GLDrawableImpl.lockSurface(GLDrawableImpl.java:130)
at com.sun.opengl.impl.windows.wgl.WindowsWGLDrawable.setRealized(WindowsWGLDrawable.java:70)
at javax.media.opengl.awt.GLCanvas.addNotify(GLCanvas.java:413)
at java.awt.Container.addNotify(Unknown Source)
at java.awt.Window.addNotify(Unknown Source)
at java.awt.Frame.addNotify(Unknown Source)
at java.awt.Window.show(Unknown Source)
at java.awt.Component.show(Unknown Source)
at java.awt.Component.setVisible(Unknown Source)
at java.awt.Window.setVisible(Unknown Source)
at demos.gears.Gears.main(Gears.java:51)
… 9 more

)

any help will be appreciated

The startup problems of the jogl demos are probably caused by the tutorials advice to put the dlls and jars into the bin and lib/ext folder of your jre. Remove them if you haven’t done so. Also check if the Path variable points to directory, where the .dll files reside.

For your problems with the code, read from here http://www.java-gaming.org/index.php/topic,1474.msg145318.html#msg145318 to the end of the thread.

i have used the UserGuides.html (a file in the zip from the jogl.dev.java.net) that said not to place them in the lib/ext folder of my jre but in a new folder C:/Jogl/lib)

and have set the CLASSPATH and Path (not PATH on my pc is that a problem??) accordingly

thanks for your reply (reading your suggested thread right now)

edit:have read it and couldnt compile the SimpleJOGL.java file…
similar errors (packages not existing…)

ok i am at a friends house and she doesnt have anywhere the files jogl.jar or the others…
but the jogl demos from jogl-demos.dev.java.net run fine

and in my pc where i have made a mistake while installing i cant.

any explanations??

when i say that i cant run the examples from jogl-demos.dev.java.net i mean the online examples
i have NOT downloaded them and NOT tried them from my hard disc…

edited:rereading my post i find it confusing

so some clarifications: i installed jogl tried a couple of simple examples didnt compile
then i tried the online (applet?) jogl demos and they failed to launch

at a friends pc with only th jre (no jogl.jar or glue-gen.jar etc) the online demos worked perfectly

What version of jogl do you use? Where did you download it. The SimpleJOGL works relieable for various people using JOGL 1.1.X.
Are you sure you have no jogl/gluegen dlls anywhere in your jre/jdk folders? Maybe you’ve forgotten about them. Try a system wide search for them.

the jogl that i have downloaded on my pc is the latest current release from jogl.dev.java.net

the pc of my friend was scanned but didnt find anything…

ok, after i destroy my friends pc, ill go home and maybe try this…
uninstall every java thingy from my pc and try downloading everything from the very beginning???
or it doesnt worth it and i will find a way to run a simple jogl app?

edited: i just reread your post along with some jogl installing tutorials…
you mean that if i have (not my friends pc) in my jdk/jre folders a any dllls :
1)i cant compile?
2)i cant run the online demos??

when i go home i will try it and see

(my friends pc with no dlls (none showed up in the search) how can it run the online demos??
the answer for this question is not so important , just curiousity)

Did you download the jogl 1.1.1a or the jogl 2.0 nightly? The latter is very new and somewhat different than the 1.1.1a (mosty getGL() calls have to be changed ro getGL().getGL2()). Also afaik the 2.0 version is not final.

The compile problem at your friends computer may be caused because of JOGL2 libraries and a JOGL1 example.
Scan your PC, too. The runtime problems on your computer may be caused by jogl/gluegen stuff lying around in your JRE folder.

Don’t fall for the habbit to abbrevate or summarize error messages. Always post full error-messages (copy and paste whole console output) :slight_smile:

the compile problem is only on my computer, my friend doesnt have any more java than the jre (so cant compile… but the demos do work…)

i have the last stable release (link http://download.java.net/media/jogl/builds/archive/jsr-231-1.1.1a/jogl-1.1.1a-windows-i586.zip from here https://jogl.dev.java.net/servlets/ProjectDocumentList?folderID=11509&expandFolder=11509&folderID=11508
stable release of june…

when i go home i will rerun and print all of the errors…

thank you for your time…

i have extracted the class files from the jogl.jar in the same folder i have a copy of SimpleJOGL.java

and now the compile only has the message GL2 class cant be found (that means that it can find the jogl classes because they are thrown in the same folder… then i checked the demos of the official site, yet again they dont run, but the fact that my compilation moved forward (i think) is a positive sign)

so where can i find this GL2 class???

i managed to compile the file HelloWorldWindow.java but then i cant run it

the source is

/*

  • Jogl Tutorial
  • Copyright © 2004
  • Kevin Conroy kmconroy@cs.umd.edu
  • This library is free software; you can redistribute it and/or
  • modify it under the terms of the GNU Lesser General Public
  • License as published by the Free Software Foundation; either
  • version 2.1 of the License, or (at your option) any later version.
  • This library is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  • Lesser General Public License for more details.
  • You should have received a copy of the GNU Lesser General Public
  • License along with this library; if not, write to the Free Software
  • Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    */
    import java.awt.Color;
    import java.awt.Frame;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;

import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLDrawableFactory;

/**

  • Based on NeHe Production Lesson 01 ported by Kevin Duling
  • (jattier@hotmail.com)
  • @author Kevin Conroy (kmconroy@cs.umd.edu)
    /
    public class HelloWorldWindow {
    /
    *
    • Main function which will create a new AWT Frame and add a JOGL Canvas to

    • it

    • @param args Runtime args
      */
      public static void main(String[] args) {
      Frame frame = new Frame(“Hello World!”);

      GLCanvas canvas = new GLCanvas (new GLCapabilities());
      frame.add(canvas);

      frame.setSize(300, 300);
      frame.setBackground(Color.white);

      frame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
      System.exit(0);
      }
      });

      frame.show();
      }
      }

the error message is
com/sun/gluegen/runtime/DynamicLookupHelper
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:106)
at javax.media.opengl.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:520)
at javax.media.opengl.GLCanvas.(GLCanvas.java:131)
at javax.media.opengl.GLCanvas.(GLCanvas.java:90)
at HelloWorldWindow.main(HelloWorldWindow.java:45)

Process completed.

i have another question, i can’t run the demos of the jogl.dev.net
but some games that use opengl (and i foudn their links here) are working fine…

i suspect they include their own jogl.jar and native files???

You don’t need this, if the classpath is set up correctly, so there is something wrong with it. Go into the cmd and issue the SET command. Check the values of your Path and CLASSPATH variable. Post it here. Also make a directory listing of the folder you copied the jogl files to and post it here.

The GL2 is jogl2 only, so you have an example for JOGL2, but the JOGL1 classes.

Hmm. Is this the full output? Looks like it is missing the actual error…

OpenGL is a native graphics library, which normally comes with your operating system or gfx card driver. Jogl is only a binding to access this library from java programs. So if you have non-java games, they access the opengl library directly while java games need the jogl (or lwjgl) library.

The jogl online demos (applet or java web start) have their own jogl and should work independent of a locally installed jogl library, unless jogl/gluegen jars/dlls lie around in your JRE or JDK folder. That’s the reason why I gave the advice to scan your system for jogl/gluegen files. Did you do it on your personal machine yet? Did you find anything?

[quote] Did you do it on your personal machine yet? Did you find anything?
[/quote]
i mentioned above that i do have made a search (one with “glu” and another one with “jogl”) and didnt find anything…, i did find some in the user directory
/skinny/.jnlp-applet/cache/UNKOWN/211a9b46ee5e65478dd39df10281af60eaad076/
in there i found gluegen-rt-natives-windows-i586.jar, gluegen-rt-natives-windows-i586.idx and cache.lck , no dlls… should i delete them?/

[quote]The GL2 is jogl2 only, so you have an example for JOGL2, but the JOGL1 classes.
[/quote]
i have the current release 1.1.1.a (from june i think) the GL2 class missing is from an example you linked me (its an example of this forum and you told me to look at the end of it)
the error message is from another example, i posted the complete code above, and is not a compile message, as i said i managed to compile it (after extracting the files in the same directory) and it is the error when i try to run it (i use JCreator, without making any projects, simply as a compiler and executer?? maybe that is relevant somehow??)

i know i dont need to place them in the same directory… but it helped me compile…

this is the COMPILE error from the SimpleJOGL (the link you gave me)
--------------------Configuration: --------------------
F:_____DESKTOP at 10 June 2009\Jogl\examples from a site\SimpleJOGL.java:54: cannot find symbol
symbol : class GL2
location: class SimpleJOGL
GL2 gl = drawable.getGL().getGL2();
^
F:_____DESKTOP at 10 June 2009\Jogl\examples from a site\SimpleJOGL.java:54: cannot find symbol
symbol : method getGL2()
location: interface javax.media.opengl.GL
GL2 gl = drawable.getGL().getGL2();
^
F:_____DESKTOP at 10 June 2009\Jogl\examples from a site\SimpleJOGL.java:62: cannot find symbol
symbol : variable GL2
location: class SimpleJOGL
gl.glShadeModel(GL2.GL_SMOOTH); // try setting this to GL_FLAT and see what happens.
^
F:_____DESKTOP at 10 June 2009\Jogl\examples from a site\SimpleJOGL.java:66: cannot find symbol
symbol : class GL2
location: class SimpleJOGL
GL2 gl = drawable.getGL().getGL2();
^
F:_____DESKTOP at 10 June 2009\Jogl\examples from a site\SimpleJOGL.java:66: cannot find symbol
symbol : method getGL2()
location: interface javax.media.opengl.GL
GL2 gl = drawable.getGL().getGL2();
^
F:_____DESKTOP at 10 June 2009\Jogl\examples from a site\SimpleJOGL.java:75: cannot find symbol
symbol : variable GL2
location: class SimpleJOGL
gl.glMatrixMode(GL2.GL_PROJECTION);
^
F:_____DESKTOP at 10 June 2009\Jogl\examples from a site\SimpleJOGL.java:78: cannot find symbol
symbol : variable GL2
location: class SimpleJOGL
gl.glMatrixMode(GL2.GL_MODELVIEW);
^
F:_____DESKTOP at 10 June 2009\Jogl\examples from a site\SimpleJOGL.java:83: cannot find symbol
symbol : class GL2
location: class SimpleJOGL
GL2 gl = drawable.getGL().getGL2();
^
F:_____DESKTOP at 10 June 2009\Jogl\examples from a site\SimpleJOGL.java:83: cannot find symbol
symbol : method getGL2()
location: interface javax.media.opengl.GL
GL2 gl = drawable.getGL().getGL2();
^
F:_____DESKTOP at 10 June 2009\Jogl\examples from a site\SimpleJOGL.java:86: cannot find symbol
symbol : variable GL2
location: class SimpleJOGL
gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
^
F:_____DESKTOP at 10 June 2009\Jogl\examples from a site\SimpleJOGL.java:86: cannot find symbol
symbol : variable GL2
location: class SimpleJOGL
gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
^
F:_____DESKTOP at 10 June 2009\Jogl\examples from a site\SimpleJOGL.java:94: cannot find symbol
symbol : variable GL2
location: class SimpleJOGL
gl.glBegin(GL2.GL_TRIANGLES);
^
F:_____DESKTOP at 10 June 2009\Jogl\examples from a site\SimpleJOGL.java:107: cannot find symbol
symbol : variable GL2
location: class SimpleJOGL
gl.glBegin(GL2.GL_QUADS);
^
13 errors

Process completed.

and this is the RUNTIME error of the other example i tried, which i managed to compile
(the source of this example is posted HelloWorldWindow)

--------------------Configuration: --------------------
Exception in thread “main” java.lang.NoClassDefFoundError: com/sun/gluegen/runtime/DynamicLookupHelper
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:106)
at javax.media.opengl.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:520)
at javax.media.opengl.GLCanvas.(GLCanvas.java:131)
at javax.media.opengl.GLCanvas.(GLCanvas.java:90)
at HelloWorldWindow.main(HelloWorldWindow.java:45)

Process completed.

i think you should stop trying
i won’t, so if i figure anything out i will post it here…

thank you again

i tried to run this https://jogl-demos.dev.java.net/applettest.html

the message at the bottom was :
Error:java.io.IOException:Cannot find certificates for JNLPAppletLauncher class

any clue about it?

Should be ok, that are the dependencies downloaded by the JNLPAppletLauncher. They don’t interfere with your local settings, so you won’t need to delete them.

Afaik there was something about a security issue, so the JNLPAppletLauncher won’t work with the latest java version. I think there was a post about it here in the last 30 days or so.

Seems you used the jogl2 version converted by falcon. Use the one from my post (the one I directly linked).

Are you sure you have the right gluegen version in your classpath?

So it seems JCreater does not use the CLASSPATH correctly (or there is some problem with this -> call SET and post the CLASSPATH and Path values).

So unpacking jogl solved your compile problem because all classes directly needed by the example are available. The runtime problem is caused by the missing gluegen-rt classes then, because you didn’t unpack them and the CLASSPATH seems to have no effect.

Delete the unpacked jogl classes and try to fix your CLASSPATH. You could also setup the dependencies in a JCreator project (never used this, so no idea how), or you could install Netbeans and our OpenGL pack (see my signature).

ok i maganged to run the demos from the site http://www.cs.umd.edu/~meesh/kmconroy/JOGLTutorial/
(its only one demo actually)
i unpackaged everything in the same folder and JCreator compiled successfully and most importantly run successfully

the CLASSPATH value is:
.;C:\Program Files\Java\jre1.6.0_02\lib\ext\QTJava.zip;C:\Jogl\gluegen-rt.jar;C:\Jogl\jogl.jar

and the Path:
C:\Program Files\PC Connectivity Solution;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Diskeeper Corporation\Diskeeper;C:\Program Files\QuickTime\QTSystem;C:\Program Files\Common Files\Adobe\AGL;C:\Program Files\Ant\apache-ant-1.7.1\bin;C:\Jogl;C:\Program Files\Java\jdk1.6.0\bin

i think the next step is for me to be able to run the online demos, online,
and then try to compile and run the source of the demos on my pc

cylab i want to thank you…
i have managed to compile and run the examples of the demos from my computer
(only those supported by my system of course)
(i am talking about the examples i downloaded from jogl.dev from the current release 1.1.1.a)

i used the command prompt not JCreator (and the instructions included in the html file)

now on to figure out why the online demos arent working… (which is not very important though

(which is not that important, so dont waste precious time on me)

thank you again for your time