Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Trying to get jar to run as web start/jnlp  (Read 2579 times)
0 Members and 1 Guest are viewing this topic.
Offline mike_bike_kite
« Posted 2012-06-26 20:19:34 »

I wanted to use web start with my Java game as it gave me access to full screen mode. The downsides are that the user now has to approve the program (as full screen and getting high scores from web both require permissions) whereas before they could just play the game as an applet. The other (rather major) downside is I can't get it to work outside of my own dev machine (an XP SP3).

Can anyone suggest where I might have gone wrong?

http://www.checkmypages.com/swarm

Many thanks

Mike

Arcade swarm
Board Chess - Checkers - Othello
Offline gouessej
« Reply #1 - Posted 2012-06-26 21:15:53 »

Hi

At least one of your JARs is not signed. Don't forget this rule: all JARs directly mentioned inside a single JNLP file must be signed with the same signature. Your application requires permissions but it gives you the possibility to use much more features, I don't see that as a downside. You will perhaps buy a "verified" certificate and the warning will look less scary, don't worry. Thanks for using Java Web Start, it is better than a single fat JAR that might be opened by ... WinRAR  Angry

Offline kappa
« League of Dukes »

JGO Kernel


Medals: 78
Projects: 15


★★★★★


« Reply #2 - Posted 2012-06-26 21:17:55 »

Thanks for using Java Web Start, it is better than a single fat JAR that might be opened by ... WinRAR  Angry
JWS doesn't suffer from the same problem? JNLP files occasionally open with a text or xml editor.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gouessej
« Reply #3 - Posted 2012-06-26 21:27:19 »

Thanks for using Java Web Start, it is better than a single fat JAR that might be opened by ... WinRAR  Angry
JWS doesn't suffer from the same problem? JNLP files occasionally open with a text or xml editor.
As far as I know, it is occasionally opened by a web browser (MSIE?) as an XML file if Java is not installed under Windows. There are more people using WinRAR than any XML editor and I only had this problem when Java was not installed, Bluefish tried to open JNLP files by default. I assume maybe some people reproduce the same problem under Windows but not with a simple text editor; if you were right, it would be extremely problematic.

Offline mike_bike_kite
« Reply #4 - Posted 2012-06-26 21:33:56 »

At least one of your JARs is not signed.
It's actually only one jar. I signed it on my dev PC and then transferred it to the server along with the jnlp file. I'll be the first to admit I'm feeling around in the dark here. I thought web start and jnlp were almost the same thing but obviously not - I'll google to find out more. Is it better to use JWS rather than JNLP then?

The downside is that people might get put off running the program if they're told it requires special permission to run. I think nothing of running any applet but I'm wary of running applications. Why it needs any permissions at all to just run in full screen mode and to access a web page (in the same directory) is beyond me (and perhaps this thread).

I believe a verified cert costs a few hundred $ which, for a free app, doesn't make sense.
Quote from: kappa
JWS doesn't suffer from the same problem? JNLP files occasionally open with a text or xml editor.
I seem to get different behaviour depending on which PC I open the page on - my dev PC just goes quiet after loading the Java, my wife's PC just displays the XML on screen, none actually play the game which is a bit frustrating.

EDIT: actually when I run on my PC now it downloads the app, starts of Java, asks if it's OK to run and then says it's unable to run the application :
Name : Retro arcade game ...
Publisher : Mike Robinson
From file :// Huh

Arcade swarm
Board Chess - Checkers - Othello
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #5 - Posted 2012-06-26 21:42:17 »

JWS is a technology. JNLP is the XML protocol it uses. So JNLP IS JWS.

Now I opened your JNLP file in a text editor and this is what I saw:
1  
codebase="file:///C:/Java/AlienSwarm/">

Uhhhhhh so how is that gonna be found on my computer? Grin
You're supposed to put the link to the website the JAR is on, which in this case is http://www.checkmypages.com/swarm/

The following two conditions have to be true:
- CodeBase + JarName = link to JAR.
- CodeBase + JNLP file name = link to the JNLP file.

Also, you need 'href=<JNLP file name>' right below the 'codebase entry'

When I made these changes, the game ran fine Smiley

Offline mike_bike_kite
« Reply #6 - Posted 2012-06-26 21:45:27 »

That explains it. Can I just compile and sign on the server then and it will all start to work? I use the following command to sign:

jarsigner -keystore yourKeystore test.jar YourName

(Well spotted by the way)

Mike

Arcade swarm
Board Chess - Checkers - Othello
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #7 - Posted 2012-06-26 21:47:37 »

As long as the 'keystore' is on the server, then yes.

Offline mike_bike_kite
« Reply #8 - Posted 2012-06-26 22:06:02 »

As long as the 'keystore' is on the server, then yes.
  • I altered the jnlp file which pointed at the local file - I just removed the codebase entry which I believe should make it use the current directory. Same issue.
  • I transferred 2 files from my dev machine - one concerning a keystore and one my "company" name. Same issue.
  • I tried recompiling the jar and resigning it - it said key will expire in 6 months. Same issue.
  • I tried to create a new cert in my name but it said "the Key pair not generated, alias <Mike Robinson> already exists".

Any other things I should try?

Arcade swarm
Board Chess - Checkers - Othello
Offline mike_bike_kite
« Reply #9 - Posted 2012-06-26 22:27:35 »

It worked  Grin as well as the problems you pointed out, it turned out that recompiling wasn't so good on the server as I didn't yet have all the new images there (I was relying on them being in the jar). If anyone feels brave could they try it on their machine. I'd like to know whether it runs (obviously) and if it allows you to enter high scores.

and thanks for your help guys.

Mike

Arcade swarm
Board Chess - Checkers - Othello
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gouessej
« Reply #10 - Posted 2012-06-26 22:35:32 »

It worked  Grin as well as the problems you pointed out, it turned out that recompiling wasn't so good on the server as I didn't yet have all the new images there (I was relying on them being in the jar). If anyone feels brave could they try it on their machine. I'd like to know whether it runs (obviously) and if it allows you to enter high scores.

and thanks for your help guys.

Mike
Sorry, I get this:
Quote
net.sourceforge.jnlp.LaunchException: Fatal: Launch Error: Could not launch JNLP file.
   at net.sourceforge.jnlp.Launcher.launchApplication(Launcher.java:600)
   at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:889)
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:616)
   at net.sourceforge.jnlp.Launcher.launchApplication(Launcher.java:594)
   ... 1 more
Caused by: java.lang.IllegalArgumentException: Invalid display mode
   at sun.awt.X11GraphicsDevice.setDisplayMode(X11GraphicsDevice.java:414)
   at AlienSwarm.main(AlienSwarm.java:834)
   ... 6 more
Caused by:
java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:616)
   at net.sourceforge.jnlp.Launcher.launchApplication(Launcher.java:594)
   at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:889)
Caused by: java.lang.IllegalArgumentException: Invalid display mode
   at sun.awt.X11GraphicsDevice.setDisplayMode(X11GraphicsDevice.java:414)
   at AlienSwarm.main(AlienSwarm.java:834)
   ... 6 more

Please don't create display modes, pick one instance from those already available:
http://docs.oracle.com/javase/6/docs/api/java/awt/GraphicsDevice.html#getDisplayModes()

Anyway, I remind you that AWT full screen mode does not work as expected under GNU Linux with KDE 4, the task bar is drawn above the window Sad If you want to work around this bug, you have to use the native windowing system of JOGL (NEWT) or LWJGL.

Offline mike_bike_kite
« Reply #11 - Posted 2012-06-27 08:50:59 »

Thanks for the heads up. I'd (wrongly) assumed that all monitors supported a low refresh 640x480. I've corrected this now. I don't currently have a Unix box to test on but apparently my Rasberry Pi is now on order so this may change.

Does it work now?
Does JWS/JNLP cache the program for a faster start?
Is there a splash screen?
Does the high score thing actually save your score?

Mike

Arcade swarm
Board Chess - Checkers - Othello
Offline gouessej
« Reply #12 - Posted 2012-06-27 16:05:06 »

Thanks for the heads up. I'd (wrongly) assumed that all monitors supported a low refresh 640x480. I've corrected this now. I don't currently have a Unix box to test on but apparently my Rasberry Pi is now on order so this may change.

Does it work now?
Does JWS/JNLP cache the program for a faster start?
Is there a splash screen?
Does the high score thing actually save your score?

Mike
Everything works fine now. It's not in full screen mode but I don't mind.

Offline xranby

Senior Newbie


Medals: 4



« Reply #13 - Posted 2012-09-21 08:28:43 »

This game installed nicely using JamVM + OpenJDK 7 + icedtea-web on my Raspberry Pi including adding a launcher icon on the Rasperry Pi x11 desktop.
http://www.raspberrypi.org/phpBB3/viewtopic.php?p=178262#p178262

The game did only open an undecorated window, i worked around it by manually hiding the LXDE launchbar and setting the background to a nice black color to get a nice "fullscreen" arcade experience on an old tube.

Most time in the game is spent in the Java2D software rendered draw routines, do consider switching to something hardware accelerated like JogAmp JOGL GL2ES2 profile that work on both desktop and mobile devices by using a common subset of OpenGL ES 2 and OpenGL 2 calls.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

theagentd (10 views)
2014-10-25 15:46:29

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (45 views)
2014-10-16 15:22:06

Norakomi (34 views)
2014-10-16 15:20:20

lcass (38 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (68 views)
2014-10-14 00:35:47

TehJavaDev (60 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!