aspose file tools*
The moose likes JNLP and Web Start and the fly likes JOGL Webstart Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "JOGL Webstart" Watch "JOGL Webstart" New topic
Author

JOGL Webstart

Leo Hassaine
Greenhorn

Joined: Aug 02, 2010
Posts: 25
I am a recent graduate from university, and know Java relatively well (for my own needs) but have never deployed a Java applet to a browser. My question is, do any of you know any good step by step resources for deploying a JOGL (Java OpenGL) app to webstart?

I have found a few, but having never made applets some of the steps are unclear to me. For example, you have to include all the code in .jar files. How many .jar files? Does one of them need a main method? Which one?

Any help would be appreciated!
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
JNLPAppletLauncher helps with deploying a JOGL app both as an applet and as a JavaWebStart app.

In general, deploying via JWS and deploying as an applet are different mechanisms, and the code will be slightly different for each of these. E.g., applets do not have a main method, but instead have their lifecycle managed via init, start and stop methods.

Applets are generally delivered as a jar file; there may be more if the applet uses external libraries. See http://download.oracle.com/javase/1.4.2/docs/guide/misc/applet.html and http://download.oracle.com/javase/1.5.0/docs/guide/plugin/developer_guide/contents.html for more information about the APPLET tag and how to deploy applets.
Leo Hassaine
Greenhorn

Joined: Aug 02, 2010
Posts: 25
Thanks for the reply, but specifically, to deploy Java Webstart does your program need to be in an Applet format with the start init stop like you mentioned? There seems to be very little material on deploying JOGL via JWS.
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
No. It's actually more common to deploy regular applications (having a main method) with JWS. The JOGL User's Guide has a section on deploying JOGL apps via JWS; it sounds pretty simple.
Leo Hassaine
Greenhorn

Joined: Aug 02, 2010
Posts: 25
Hi, I've read that page and it didn't help too much. I have never used JNLP before, so am looking for a tutorial or walkthrough of how to deploy JOGL in a browser (including all the HTML stuff and how to organise the .jar packages etc.).
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
A quick search for java web start found this tutorial: http://download-llnw.oracle.com/javase/tutorial/deployment/webstart/index.html.
Leo Hassaine
Greenhorn

Joined: Aug 02, 2010
Posts: 25
That link was very helpful, thanks!
Leo Hassaine
Greenhorn

Joined: Aug 02, 2010
Posts: 25
I am starting to think that deploying a JOGL application with webstart is impossible (I haven't seen any examples other than the official sun ones).

I've spent something crazy like 10 hours writing and rewriting this JNLP file:



I first got a class not found error which I fixed, but now the webstart splash screen dissapears after 3 or 4 seconds of loading and doesn't give an error, nor does it run! I am wondering if "GUIServer" is right to put as the main-class desc? Do I put RunMe.GUIServer instead?

ANY help would be greatly appreciated, I've searched high and low on dozens of forums and have yet to find a single non-sun/oracle example (their files are signed so its easier)

Thanks
Leo Hassaine
Greenhorn

Joined: Aug 02, 2010
Posts: 25
Any help at all?
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
main-class is a fully qualified class name, so if it's in a package called "RunMe", the yes - that needs to be reflected there.

The value of "href" looks suspicious - the example in the tutorial only has the filename, not the complete URL. I think it should be

codebase="http://www.leolol.com/apps/" href="modeldemo.jnlp"
Leo Hassaine
Greenhorn

Joined: Aug 02, 2010
Posts: 25
Firstly, thanks so much for the reply Lester, I'm going slightly crazy trying to fix this.

So I tried the same code today (unchanged from my post) and it works when I open it from inside dreamweaver.. This confused me loads so I saved the JNLP to the desktop and it worked there too!

I then changed the href to what you suggested, tried it, and it didn't work so I changed it back. Now that I've changed it back it still works in dreamweaver but not on the desktop (and obviously still not in the browser).

After tearing my hair out for a few minutes, I copy pasted all the Jogl.dll, gluegen-rt.dll files etc. onto the desktop to see if that was the problem. I ran the JNLP and it worked!

This is confusing as the official JNLP JOGL examples simply link to the same extension I have up there ^ which is supposed download the natives for you. And also, why did the JNLP work from the desktop once, but not again?

This is also so messy and confusing, I think I know now why I couldn't find any amateur deployed webstart JOGL apps.

Any help or clarification would be greatly appreciated as usual.

P.S The main class isn't in a package (i.e the default package in Eclipse) so I just left it as GUIServer (worked once, so don't think thats the problem, also changed it to RunMe.GUIServer a while ago and got a classnotfound exception)
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
I think you're right that you've confused yourself with some of the intricate details :-) Prior my previous post I spent some 30 minutes taking an existing JOGL desktop app to making it a JWS app, since I got interested in how to do that (and I've never deployed a JWS app before, JOGL or not). Just following the general JWS tutorial, and then adding the JOGL-specific stuff proved sufficient. Here's what I ended up with:

HTML

JNLP

OpenGLTest is the class that contains the main method, and the jar file has a manifest entry that points to it; I'n not sure if that's actually necessary, but there's no harm in having it, and it makes running the app as desktop (non-JWS) app easier, so I kept it.
Leo Hassaine
Greenhorn

Joined: Aug 02, 2010
Posts: 25
Thanks again for the help Lester. After comparing your JNLP file to mine, all I changed was the j2se version from 1.4 to 1.5 and now it works from the browser! Confusing, but I hope it keeps working.

Just as I thought everything was fixed however, I have come across another snag. My program needs to read and write text files. On the desktop this is fine as there is a folder called shapes/ with the relevant text files inside.

I've read that with JavaWebstart this is a bit tricky and I may have to request all permissions in the security tag?

(Also if you're interested, my JWS seemed to work simply using a link straight to the JNLP file as apposed to that HTML Script you have)

You're helps been a godsend so far, so cheers again!
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
My program needs to read and write text files. On the desktop this is fine as there is a folder called shapes/ with the relevant text files inside.

I've read that with JavaWebstart this is a bit tricky and I may have to request all permissions in the security tag?

That's how I read the security section of the JWS tutorial - add a <security> element to the JNLP file and sign the jar files.

Also if you're interested, my JWS seemed to work simply using a link straight to the JNLP file as apposed to that HTML Script you have

That's great - I'd much rather not have to load an external script.
Nick Jp George
Greenhorn

Joined: Oct 08, 2010
Posts: 18
Hello, just found this thread as I've been desperately trying to get my JoGL code into something portable. I'm using the JogAmp stuff...

Full disclosure: I don't really know what web start is all about- I just want to be able to share a game I made with my friends. I made a jnlp file with the code you posted, Lester- literally, made a txt file in notepad, renamed it .jnlp, and changed the jar references to my jars, and updated the jnlp link to the newest one from jogAmp. I get that I'm missing the field <jnlp><information><vendor>. Is there an easy way to get this working?
Nick Jp George
Greenhorn

Joined: Oct 08, 2010
Posts: 18
Ok, I think I almost have the jnlp working. One big change to your jnlp file I made was the resource: since I'm using the new, JogAmp stuff, I changed it to <extension name="jogl-all-awt" href="http://jogamp.org/deployment/webstart/jogl-all-awt.jnlp" />

I get all of this mess:



Is this a signed/unsigned problem?
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
Try putting this in the JNLP file:

Despite everything being signed, you still need to declare that the code needs special permissions.
 
 
subject: JOGL Webstart