How to make Jogl work with Janel?

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

How to make Jogl work with Janel?

Cousken
Hello all!

I'm a C++ developer who is learning Java and OpenGL by developing a game much like Bay12's Dwarf Fortress.

I've made a nice project that displays a rotating polygon, so that part i've had no problem with. However i'm a bit concerned about the distribution of the final product to less tech savy people using windows. Most people don't know anything about java or how to run it so i want the application to start by double clicking on a file. I tried doing an executable JAR but that doesn't work on my machine, and a .bat file isn't going to cut it since not eveyone has their Path set up to support java.

What i am looking into right now is .exe java launchers, specifically Janel I set it up correctly as far as i know, but all i get when i run it is a warning message.

When running the Window32 exe i get: "Error in Java launcher. Error occurred while attempting to find Java class App"

When running Console32 i get:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLCapabilitiesImmutable
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLCapabilitiesImmutable
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Error in Java launcher. Error occurred while attempting to find Java class App"

Since the application is running just fine from Eclipse or by using java -jar i don't really think it's an issue with itself, what i suspect is that there is some issue with compatibility between Janel and Jogl. I only have two classes, App with the main loop and Engine.

Help on solving this issue would be greatly appreciated :) The game will be available for free for everyone so maybe i can use it as enticement? :D I want to point out that my main goal is for anyone who has a JRE installed to be able to double click a file to launch the game.
Reply | Threaded
Open this post in threaded view
|

Re: How to make Jogl work with Janel?

Pixelapp
What we are encouraged to do here at Jogamp is to use this http://jogamp.org/jogl/doc/deployment/JOGL-DEPLOYMENT.html.

If you would like a quick demo just click here: http://jogamp.org/deployment/jogamp-current/jogl-demos/Gears.jnlp.
Reply | Threaded
Open this post in threaded view
|

Re: How to make Jogl work with Janel?

Cousken
Thanks a lot for the reply! A Webstart application would work fine for my demographic. Do you happen to know how to solve the issue of local save games?

I've had a very long look at the JOGL Deployment page you linked to and with my limited knowledge of Java it's hard to understand. I used a tutorial at Oracle to develop a Webstart for my application, unfortunately all i managed to make it do is open the .jnlp file as XML and not launch the application :( I have no idea how to debug it, if someone could take a look and help me out i would really appreciate it.

EDIT: I downloaded the .jnlp file to my desktop and ran it, at least now i got a little more debugging information. Unfortunately i still don't know how to fix it :( The errors i got are:

java.lang.NoClassDefFoundError: javax/media/opengl/GLCapabilitiesImmutable at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(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.ClassNotFoundException: javax.media.opengl.GLCapabilitiesImmutable at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 9 more
Reply | Threaded
Open this post in threaded view
|

Re: How to make Jogl work with Janel?

Pixelapp
To save games I use JNLP MUFFINS. You're going to have to Google the examples and solutions.

Muffins are the only ones that work with JNLP. Other solutions will throw exceptions.

Moreover, your example is missing this part

<resources>
  <property name="sun.java2d.noddraw" value="true"/>
  <extension name="jogl-all-awt" href="http://jogamp.org/deployment/archive/rc/v2.0-rc9/jogl-all-awt.jnlp" />
</resources>

Also, check your JNLP file against this http://jogamp.org/deployment/jogamp-current/jogl-demos/Gears.jnlp which complete.



Reply | Threaded
Open this post in threaded view
|

Re: How to make Jogl work with Janel?

Pixelapp
In reply to this post by Cousken
Don't worry, your thrown exception is pretty common. We see it everyday. Just check at my previous response.
Reply | Threaded
Open this post in threaded view
|

Re: How to make Jogl work with Janel?

Cousken
Thanks for your help, it's helped me move forward. I'm not getting that error, but now the application is complaining about trying to use unsigned resources...

JNLPException[category: Säkerhetsfel : Exception: null : LaunchDesc:  <jnlp codebase="http://jogamp.org/deployment/archive/rc/v2.0-rc9/" href="jogl-all-awt.jnlp" version="v2.0-rc9"> 
A lot of info cut out here
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
        at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
        at com.sun.javaws.Launcher.prepareResources(Unknown Source)
        at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
        at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
        at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
        at com.sun.javaws.Launcher.launch(Unknown Source)
        at com.sun.javaws.Main.launchApp(Unknown Source)
        at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
        at com.sun.javaws.Main$1.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Reply | Threaded
Open this post in threaded view
|

Re: How to make Jogl work with Janel?

Pixelapp
Your codebase url is wrong. codebase="http://jogamp.org/deployment/archive/rc/v2.0-rc9/".

I would believe this is your codebase if you were an administrator at jogamp.org, which I think you are not.

This is how I launch my program from my desktop codebase="file:///C:\Users\Main\Desktop"

Note: if your main program's jar file is on a server (i.e: not on your desktop) you would delete "file:///".

Please feel free to keep the questions coming.

Reply | Threaded
Open this post in threaded view
|

Re: How to make Jogl work with Janel?

Sven Gothel
Administrator
In reply to this post by Cousken
On 07/09/2012 08:26 PM, Cousken [via jogamp] wrote:
> Thanks a lot for the reply! A Webstart application would work fine for my
> demographic. Do you happen to know how to solve the issue of local save games?

There are some JNLP services enabling you to save some data
related to your website - check the JNLP spec.

>
> I've had a very long look at the JOGL Deployment page you linked to and with
> my limited knowledge of Java it's hard to understand.

Have you checked the wiki about JNLP/Applets and the jogl applet test page?
Especially the latter which big bold fonts mentioning 'including documentation' ?
IMHO it's pretty simple to copy/paste the html and JNLP snippets
and edit them for personal use - maybe while browsing and double checking
the applet / jnlp specs.

> I used a tutorial at
> Oracle to develop a Webstart for my application, unfortunately all i managed
> to make it do is open the .jnlp file as XML and not launch the application :(

Your javascript tells me java7 is required,
where your jnlp file only requires 1.6+

When I launch your demo manually 'javaws http://politanski.se/ws/ws.jnlp'
it shows that you have compiled your classes with Java7 I assume,
i.e. can't launch w/ Java6.

I recommend you compile w/ Java6, so you have a wider audience.

If you want to use Java7 and 'crosscompile' for Java6 you have to jump through
some hoops as you can see in GlueGen
<http://jogamp.org/git/?p=gluegen.git;a=blob;f=make/jogamp-env.xml;hb=HEAD>,
which deals w/ setting the Java source/target language level including
using a matching rt.jar - grep for 'target.rt.jar'.
<http://jogamp.org/git/?p=gluegen.git;a=blob;f=make/build.xml;h=671e3c3c32352dbba7a339279a6884e9de65828c;hb=HEAD#l667>
But I guess it's most easy to just use Java6 ..

Other than this, the ws.jnlp looks ok, but I can't test.

> I have no idea how to debug it, if someone could take a look
> <http://politanski.se/ws/ws.html> and help me out i would really appreciate it.

Due to bug 591 (which is already fixed but not 'released')
<https://jogamp.org/bugzilla/show_bug.cgi?id=591>
you are not able to set jogl debug flags [yet].
However, w/ next release you can set the JVM properties in the JNLP,
as mentioned in the bug report and enable trace via the java control panel
or on 'unix' $HOME/.java/deployment/deployment.properties:
  deployment.trace=true
  deployment.log=true


~Sven



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

Re: How to make Jogl work with Janel?

Cousken
Hello Sven!

Tanks for your reply! The wiki page you tipped me about was really helpful in understanding how it all works instead of just solving specific issues. I haven't found it before, that's why i turned to more experienced people via this forum. Now my development process should go much smoother, thanks again :)

I've managed to set up my jnlp file just fine now, at least from the desktop. Once i double klick it, it launches my application. However clicking on the Launch button on the web page still only opens the Jnlp file as XML, is that an issue with the html then?

Tack så mycket!
Reply | Threaded
Open this post in threaded view
|

Re: How to make Jogl work with Janel?

Sven Gothel
Administrator
On 07/10/2012 01:29 PM, Cousken [via jogamp] wrote:

> Hello Sven!
>
> Tanks for your reply! The wiki page you tipped me about was really helpful in
> understanding how it all works instead of just solving specific issues. I
> haven't found it before, that's why i turned to more experienced people via
> this forum. Now my development process should go much smoother, thanks again :)
>
> I've managed to set up my jnlp file just fine now, at least from the desktop.
> Once i double klick it, it launches my application. However clicking on the
> Launch button on the web page still only opens the Jnlp file as XML, is that
> an issue with the html then?
That's your web server hasn't setup the mime-type right
or your browser doesn't know how to handle it.

If the JNLP file doesn't have the right mime type
the browser doesn't know what to do. Mime type:
        application/x-java-jnlp-file JNLP

<http://stackoverflow.com/questions/33751/how-do-i-add-a-mime-type-to-htaccess>

Browser shall launch javaws w/ the above mime type.

~Sven


signature.asc (910 bytes) Download Attachment