JOGL in an applet

Hi all,

I’m trying to get jogl running in an applet. My application runs well from Eclipse.
The jogl.jar, jogl.dll and so are in the jar file called by the applet, but I still have got an AccessDenied exception when manualy trying to load the library with a System.loadLibrary command (just to test if the jvm find the native libraries)

I think this issue is caused by the jre 1.6 that contains a bad distribution of jogl
In eclipse, I had the same kind of issue ; I resolved it puting the jre at the bottom of the list in the “Order and Export” Tab in the “Java build path” options.

But I dont know how to do the same with an applet (or using jvm parameters or so). How can I say my applet not to load jogl packages of the jre distribution ?

An other question is about the appletLauncher used in the GearsDemo for example.
I don’t really understand how it works (it seems to be an applet loading another applet is it right ?) and why it’s usefull
I undestood it uses the jnlp file, but all this seems more complicated than using a applet running the jar file … What are the issues ?

Hi

Which version of JOGL do you use? You should rather post on jogamp.org. I only use Java Web Start to deploy JOGL applications, some other users may help you on this forum.

Hmm, i think your confusing something here as the jre doesn’t contain a jogl package. Unless of course you put jogl files into the jre directory which you should never do.

Jogl requires native files (*.dll files on windows) to be able to function, these need to be downloaded and loaded by the jvm before it can function as an applet. One way to load natives in an applet is using the appletlauncher which will start as an applet (before the normal applet), download and load the natives for you before loading the normal applet. The other method to do this is through jnlp (java 1.6.0_10+).

Thanks guys for your responses

You’re right : it’s not the jre but the jdk 1.6 that contains a jogl distribution (I checked it on my disk). My JAVA_HOME env variable is set to the JDK directory so … could this be the issue with it ?

So, using the applet launcher, you dont have to put jogl.jar and dll in the jar to deploy, am’i right ?
Ok this makes sens … but developping the jnlp file is not so easy (i already tried it) and i didn’t find good articles or tutorials on it. Would you know some ?

Trying to adapt the jnlp file from the GearsDemo but I get some ClassNotFoundException. Looks like the jar file is not found. Here follow my jnlp file



<?xml version="1.0" encoding="utf-8"?>
<jnlp href="file:///F:\work\site\test.jnlp">   // location of the jnlp file
  <information>
    <title>JOGL JNLP Applet Gears Demo</title>
    <vendor>Sun Microsystems, Inc.</vendor>
    <homepage href="http://jogl-demos.dev.java.net/"/>
    <description>Gears Demo</description>
    <description kind="short">Brian Paul's Gears demo ported to Java and JOGL.</description>
    <offline-allowed/>
  </information>

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

  <applet-desc 
      name="Gears-Applet"
      main-class="launchers.simpleLauncher.class"
      width="640" 
      height="480">
  </applet-desc>
</jnlp>


Nope, thats wrong, JOGL is a third party library and is not part of the JRE or JDK.

Nope that’s also incorrect, the appletlauncher is only a utility class, you will still have to include jogl.jar and pass the native jars to the appletlauncher via parameters. I’m not aware of any documentation of the appletlauncher but learning from the gears example is probably your best bet.

However when using the jnlp file you’ve linked to above (http://download.java.net/media/jogl/jsr-231-2.x-webstart/jogl-all-awt.jnlp) it already contains the jogl.jar and natives files (which are hosted on that same domain) so should work.

The class not found error usually means that your main class isn’t found, check main-class=“launchers.simpleLauncher.class” is correct.

[quote=“kappa,post:5,topic:36562”]
It can be used as an example but it is a bit outdated, it would be better to use this:
http://jogamp.org/deployment/webstart-next/jogl-all-awt.jnlp

Really ? That’s weird … I was pretty sure of it cause I’ve the same issue when running jogl application from eclipse and I have to put the jdk at the bottom of the “Order list” in the class path tab …
I may have confused and copied dll and jar in the jdk installation directory …

Thanks all. It’s not running yet, but I will get it !!! :smiley:

Me again

I’m getting crazy

I try to make the gearsapplet run in “local mode” : has shown on http://download.java.net/media/jogl/demos/www/applettest-jnlp.html I created a jnlp file, downloaded the jogl-demos.jar and jodl-demos-util.jar (utility of this one for the gearsappet ?), changed the href values but …

I ran it once with a bad value for the href attribute of the jnlp tag (utility of this href ? a href that links to its file ?)


<jnlp href="gearsapplet.jnlp">

JVM console says the href value is wrong. I already had this error so I know that the href value must contain the path to the jnlp file. SO I change it … and I still have the same error… Some caching issue I guess … how to flush the cach ?

Changing the jnlp name file (and the associate href value in the jnlp tag) was “enougth” to solve the trouble … but I guess A LOT of my past troubles were due to some caching issue.
So if you know how to flush ALL the cash stuff, please ;D let me know…

Now I will try to get my own applet running…

to clear the applet cache you need to go to the java control panel (on windows you find this in the windows control panel) click settings and then delete files. This will clear the java cache for you.

Java’s cache has always been kinda crappy like that, its mainly why its completely switched off in the LWJGL AppletLoader, which manages its own cache.

Thanks, this will be VERY useful !

I modified the gearsapplet to use my Applet

<?xml version="1.0" encoding="utf-8"?>
<jnlp href="file:/F:/work/site/gearsapplet/builder5.jnlp">
  <information>
    <title>JOGL JNLP Applet Gears Demo</title>
    <vendor>Sun Microsystems, Inc.</vendor>
    <homepage href="http://jogl-demos.dev.java.net/"/>
    <description>Gears Demo</description>
    <description kind="short">Brian Paul's Gears demo ported to Java and JOGL.</description>
    <offline-allowed/>
  </information>

    <resources>
      <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/>
      <property name="sun.java2d.noddraw" value="true"/>
      <jar href="file:/F:/work/site/gearsapplet/builder5.jar" main="true"/>
      <jar href="file:/F:/work/site/gearsapplet/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>

  <applet-desc 
      name="Gears-Applet"
      main-class="launchers.MyAppletLauncher"
      width="640" 
      height="480">
  </applet-desc>
</jnlp>

my applet is launched but I still get a [quote]java.lang.NoClassDefFoundError: javax/media/opengl/GLCanvas
[/quote]
The jvm can’t find jogl.jar … Why ? The

<extension name="jogl-all-awt" href="http://download.java.net/media/jogl/jsr-231-2.x-webstart/jogl-all-awt.jnlp" />

should do it … Why the appletgears can find this jar and not my applet ?

Holly s**t … ;D

The GearsApplet contains

import javax.media.opengl.awt.GLCanvas;

my applet contains

import javax.media.opengl.GLCanvas;

some version issue I guess …

I already told you that you are using an obsolete version.
It is a bit outdated, it would be better to use this:
http://jogamp.org/deployment/webstart-next/jogl-all-awt.jnlp

???

… you just dont even succeed in porting your game in an applet and encountered troubles like mine … your post was really useless ; you’d better shut up

this trouble is not linked to the jnlp usage but to my code. I like to understand what lies behind troubles, if you dont, this is your problem ; I dont change of version “just to” …
Now I can understand what happened and could eventually help other people

I have never wanted to port my game into an applet as I have realized by myself that the support of applet is quite poor on some browsers especially on Google Chrome/Chromium and Opera.

[quote=“Bobza,post:14,topic:36562”]
No comment.

[quote=“Bobza,post:14,topic:36562”]
You wrote:

I only tell you that the GearsApplet uses the current version of JOGL 2. As you can see, GLCanvas is there now:
http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/awt/GLCanvas.html

JOGL is no more on jogl.dev.java.net, it has been moved to jogamp.org. You’re using a completely obsolete version, you will have some other problems if you don’t switch to a more recent version as lots of bugs have been fixed since this move. JOGL is not a part of the JRE or JDK, it is a third party library, it is anew a community project as Oracle abandoned this project last year which explains why Sven and Michael moved all the stuff from dev.java.net to jogamp.org. My comment does not directly help you to solve your current problem but using a recent version is the best way to benefit of bug fixes. The version you’re using is almost 2 years old, that is why I say it is obsolete, I’m not exagerating. The API has changed since 2009, you won’t be able to use our examples as is if you go on using this old version. I hope my comment is not useless. Best regards.

liar :wink: Dont try to fool me, you gave up because you were not able to make your applet run ! I rode your posts on forums (java-fr I think) this week-end, where you had similar issues that the one I had (caching issues I guess)
Short memory or selective memory ? mdr

Your posts are REALLY useless :slight_smile: for the applet programming domain at least

These posts on java-fr are completely outdated, I wrote this in 2007:
http://www.javafr.com/forum/sujet-JOGL-APPLET_900532.aspx
I wrote that in one of the posts:

[quote]Je suis passé à Java Web Start
[/quote]
translation: “I have moved to Java Web Start”
I was still studying at the university at this time whereas I work as an engineer in computer science since the middle of 2007, I use JOGL every day, I improved a lot the port of JMonkeyEngine 2.0 for JOGL 1.1.1a with Mathias Henze (alias cylab), I ported JMonkeyEngine 3 and NiftyGUI to JOGL 2.0 alone, I gave some minor fixes (on the JOGL renderer) and contributions (MD2 loader) to Ardor3D… I know Google Chrome as I provided a fix for it, look in this thread:
http://code.google.com/p/chromium/issues/detail?id=10877
and there:
http://codereview.chromium.org/5971007/

The ancestor of TUER (d3caster) was an applet, that was why I was trying to make it work as an applet. However, I explained in 2007 in the thread about my game here that I prefer converting it into a full screen application. You have a very selective reading, don’t you?

I’m not a newbie and you have a very selective way of using information. You have insulted me several times, you don’t make me laugh. You have found some four-year-old posts, you have just exhumed them to laugh about me. This has to come to an end. You’re wrong, I have nothing to prove, read the lonnnnnng thread about TUER if you still believe I like applets very much (which is wrong). I only wanted to avoid you some problems by giving you a useful tip, someone else in the newbie section has solved his problem only by updating its JOGL build, my advises are not useless. Good luck (and please stop insulting me).

Please stop flooding my thread ; your responses are useless for me. So please, let other people with interesting things to write ; you look better in writing lybian restaurant tour mdr

I insulted you ? Who first lacked respect to the other ? You with size=20 response.

kappa had really intersting responses ; let him and others posts. You are not intersted in helping people, you’re just interested in showing you’re right

Bobza,

Seeing as gouessej is the strongest power on this forum trying to keep JOGL alive, and keeps defending it at every chance possible, I very much doubt that he wasn’t sincerely trying to help you. If you want people to dare to post in your future threads I suggest that you take advice for what it is, advice. It is a lot better to say “thank you but I’ve already tried that”, and not “your post was really useless ; you’d better shut up”.

Kind regards,
Mike

Man, you’re right and wise man.

Misunderstandings led to confusion.
My apologizes to gouessej (but please stop using size=20 response mdr)