Who can help me on my quest?

I’m new, so forgive me for any stupid questions :). I’m trying to create an applet like that on http://managerzone.com 's Live 3D. Sice it looks like JOGL does not support applets, could someone explain to me how to set up the Test programs from the “Getting Started” post into Java WebStart? Again, I’m new, so if anyone who answers this post could be kind enough to dumb it down for me I would be especially grateful :).

Also, if people use Java Webstart to view my app, would they have my code on their system? And would they be able to view that code?

And if they don’t have Java Webstart, and clicked on the link to the .jnlp file, would they be able to download my code directly?

Or should I just do this in Xith3d? They say that “technically” they support applets? Any ideas on this?

Oh, and by the way - the people here have been VERY helpful so far!

JOGL does support applets. Can’t think of a link for an example, but it’s pretty straightforward. Requires JOGL to be installed so that might be a problem.
It’s rather easy if you follow the getting started with Webstart tutorial to get webstart up and running. It’s easier than most people think :slight_smile:

JOGL should be fully supported in applets in mustang : there’s a plan to include JNLP extensions for native library support in applets.

http://forums.java.net/jive/thread.jspa?threadID=564&tstart=0

in the meantime, you have to workaround this by creating a JOGL installer applet (copy the dlls in the java.library.path). Unfortunately it doesn’t work on all platforms.

google for applet native library support

Lilian

Ok - but I’m having trouble getting the jnlp set up. Do I have to use an excecuteable jar? Or just a regular jar? I’ve been trying to create an excecuteable one for a while now, and whenever I run it via command prompt-it errors.

If I have to use an exec. jar, can someone explain to me how to convert the Test program in the “Getting Started” post to a exec. jar?

I guess if you are not familiar with jar it is not straightforward. I needed some time to figure it out but it is simple. 8)

When you create your jar, a file called MANIFEST is automatically created.

If you do simply something like

jar -cf Myjar.jar *.class *.java

It will be a nice jar but without information about which class actually contains the “main” function that starts the program. :wink:

So just create the archive once. Then extract the manifest file from it using jar -xvf or winrar or any other program you use to open this kind of archive

just open a notepad and write this into it at the end

Main-Class: YourMain

Where YourMain is the class name that contains the “main” function.

After you have done this create your archive using the command

jar -cfm Yourjar.jar MANIFEST.MF *.class *.java
(or all other file you need into it)

Now if you run java -jar Yourjar.jar or start it with java runtime it should works :smiley:

If you had done this but your jnlp file does not work, maybe you should add this in your jnlp file

<jar href=“yourJar.jar” main=“true”/>

in the category

and

After resource category.

Hope this can help :wink:

Ok - getting close, when I follow the instructions I can compile, but when I go to run the jar, I get this:

Exception in thread “main” java.lang.NoClassDefFoundError: net/java/games/jogl/G
LCanvas

Any ideas? (Thanks for all of your help so far guys!)

The jogl dll (if windows) or so (if linux) libraries has to be in your classpath on the machine where your run the jar file.

I usuallly but it in the /bin folder of java runtime enviromnent or in the /bin of your jdk folder :wink:

If you get this from your jnlp file i am afraid i can not help as i got exactly the same problem with mine ;D

here is a sample of JNLP file for an application using JOGL :
it references 2 user jars + jogl.jar + native libraries.

Hope it helps.

Lilian

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


A JOGL test Me JOGL test JOGL test

I’m able to compile the .java files into .class files ok, and I’m able to run them ok(with the classpath set to my jogl .dlls), but I still get the same error when I go to run the .jar with those runnable files in it. I tried including jogl.jar in my jar, still got the same error. Should I add the jogl dlls to my jar too?

sounds like the tool to compile and run your classes is jdk and the one used to run your jar is jre.

under windows if you have jre it is in

c:/Program files/java/

and the jogl dll has to be in its bin folder too.
in addition check that jogl.jar is correctly in its /lib/ext/ folder as well as in your jdk/lib/ext folder (should be the case as you manage to run them).

or also check in your jdk folder there is a jre folder in which there is a bin and a lib folder try to put a copy of the file there too maybe that will solve it.

To Lilian: Thanks for the example, in fact i pick it up before on your website to have a see but my application still does give me a error message concerning a jogl class not found. my jnlp is as follow:

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

<jnlp spec="1.0+" codebase="http://www.ccp4.ac.uk/fr45/jogl/" href="http://www.ccp4.ac.uk/fr45/jogl/Hege3D.jnlp">

  <information>

    <title>Hege3D</title>
    <vendor>Hegemonie</vendor>
    <homepage href="http://www.hegemonie.be/"/>
    <description>Moteur 3D</description>
    <description kind="short">
      Visualisation 3D d'un fief
    </description>
    <icon href="Hege.gif"/>

  </information>

  <security>
      <all-permissions/>
  </security>

  <resources>

    <j2se version="1.4"/>
    <jar href="Hege3D.jar" main="true"/>
    <extension name="jogl" href="https://jogl.dev.java.net/webstart/jogl.jnlp" />

  </resources>

  <application-desc main-class="Hegemonie3D"/>
</jnlp>

Ok - very close now. Thanks to the genius of Malek, I’m no able to execute my .jars! But now I recieve this error when I go to run my .jnlp file(using malek’s code, lillian’s didn’t seem to work on my machine):

Malek’s code:

<?xml version="1.0" encoding="utf-8" ?>
<title>Hege3D</title> 
<vendor>Hegemonie</vendor> 
<homepage href="http://www.arkfamily.org/"/> 
<description>Moteur 3D</description> 
<description kind="short"> 

Visualisation 3D d’un fief

<j2se version="1.4"/>
<jar href="Yourjar.jar" main="true"/>
   
<extension name="jogl" href="https://jogl.dev.java.net/webstart/jogl.jnlp" /> 

Error:

An error occurred while launching/running the application.

Title: Hege3D
Vendor: Hegemonie
Category: Security Error

Unsigned application requesting unrestricted access to system
Unsigned resource: http://www.arkfamily.org/MZ/JOGL/Yourjar.jar

Any ideas?

Thanks again!

The error message you got is due to the
tag in the jnlp defintion

Maybe you do not need it for your application. If you do not read file on the local system or do not use the fullscreen mode.

Try without it if you do not do this kind of actions, otherwise you need to sign your jar. :wink:

Ha! It works! You’re a genius! One more question… how do I get it to work online? I’ve got my jar uploaded, but the same code doesn’t work like it does on my system. Check it out: http://www.arkfamily.org/MZ/JOGL/JNLPLoader.html.

See what I mean? Strange. Does my server not support XML maybe?

It is not due to your application but to the server,
The server need to make a mime-type association of
the jnlp extension.

This is something that should be done on the server configuration.

This line should be added in the mime types configuration of the server:

application/x-java-jnlp-file JNLP

You can find more precise information here:
http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/setup.html

Whoa! Malek strikes again! It works! Yet another question, how do I remove the blue bar and bottom toolbar from my window? Or, in other words, make it fullscreen?

And…another question, do you know of any good documentation for learning JOGL(other than the getting started post)? Thank you soooo much for your help! You guys are fantastic!

NeHe (http://nehe.gamedev.net/) is a good place to start with OpenGL. The tutorials are in C, but if you follow them step by step you will have little problems “porting” the instructions to JOGL. You can download JOGL-Ports for the most tutorials directly from the site or from http://pepijn.fab4.be/nehe/, anyway.

Here is an example of using fullscreen mode in my prog using a keyboard event

      
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
      device = env.getDefaultScreenDevice();
if(e.getKeyCode()==KeyEvent.VK_F)
            {
            if (device.isFullScreenSupported()) 
                  {
                  if(fullScreenOn)
                        {
                        canvas.setSize(800,600);
                        this.setSize(800,600);
                        device.setFullScreenWindow(null);
                        fullScreenOn=false;
                  }
                  else
                        {
                        // Full-screen mode
                        canvas.setSize(device.getDisplayMode().getWidth(),device.getDisplayMode().getHeight());
                        device.setFullScreenWindow(this);
                        canvas.repaint();
                        fullScreenOn=true;
                        }
                  }

            }

but it will keep the frame borders, if you want to withdraw it you can do it this way with a Jrame

myFrame.setUndecorated(true);

Be careful that now you need to grant your code permission to use the fulscreen mode, to do so you have to use the tag in your jnlp and sign your jar.

For an easy way to sign your jar i suggest you read this:
http://www.dallaway.com/acad/webstart/

This is the way i did with mine.