Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Local alternative to JNLP file?

Tags:

java

jnlp

jogl

Try as I might, I can't get a JNLP file to run locally (via a double-click). It seems to be an issue of locating a jar file, even when I specify it relative to the jnlp file. I get the following error:

The field <jar>href has an invalid value: helloworld.jar

This happens even when the JNLP file is in the same folder as helloworld.jar. I've done searches and this is a consistent problem especially for people who want to package an application on a CD and use JNLP. The only Sun-provided "solution" is the ability to specify the codebase via command line, but that doesn't really help much. I don't understand why they don't assume or allow the codebase to be "." or "file://." - I tried these sorts of things in the codebase parameter of the jnlp tag (inside the file) and nothing worked.


It is extremely convenient for me to use a JNLP file because I don't need to worry about platform detection, native libraries, or even the main JOGL jar files; I simply include this line and everything is done for me:

<extension name="JOGL" href="http://download.java.net/media/jogl/builds/archive/jsr-231-2.0-beta10/webstart/jogl-all-awt.jnlp" />

I'm hoping to find something that can do the same sort of thing. If not, I can manually (or with Ant) grab the JOGL jar files, it's not a big deal; just one of those things that JNLP does for me and I'm really going to miss.


What is the best alternative to JNLP files, for me to use locally (i.e. double-click to run)? Is there anything so elegant or do I just need to write a shell script for Linux, a batch file for Windows, and have Ant detect and download the appropriate JOGL jars?

like image 892
Ricket Avatar asked Jan 09 '10 05:01

Ricket


People also ask

What is the alternative for Java Web Start?

Rocket Open Web Launch (OWL) is an open-source solution that's easy to set up, easy to use, and available to anyone who needs it. It's designed to run any application as configured in its JNLP file against a Java version which may no longer officially support Java Web Start.

Is JNLP deprecated?

Oracle has announced that Java Applet and WebStart functionality, including the Applet API, The Java plug-in, the Java Applet Viewer, JNLP and Java Web Start (containing the javaws tool) are all deprecated in JDK 9 and will be removed in a future release.

What program do I need to open a JNLP file?

You can open and edit a JNLP file in any text or source code editor, such as Microsoft Visual Studio Code or GitHub Atom.


2 Answers

I've used a .jnlp file like this to launch Java Web Start software locally

  1. specify the code base like so: <jnlp spec="1.0+" codebase="file://localhost/X:/path/to/jnlp/" href="software.jnlp">

  2. list resources with relative paths: <resources> <jar href="lib/software.jar" main="true" /> <jar href="lib/softwareLibrary.jar" main="true" /> ... </resources>

  3. and finally tell Web Start where it can find the software entry point inside the jar marked with main="true": <application-desc main-class="com.example.Main" />

The only thing you need to change when deploying remotely is the codebase parameter.

like image 107
Riku L Avatar answered Sep 19 '22 00:09

Riku L


Just remove the attributes codebase and href from jnlp tag.

<jnlp spec="1.0+">

This is supported since java 1.6u18.

like image 38
Daniel De León Avatar answered Sep 20 '22 00:09

Daniel De León