In macOS, how to run a JNLP file with OpenJDK 8?
Due to the new license of OracleJDK8, I have to use OpenJDK8. I have installed AdoptOpenJDK8 from Homebrew and it works well.
The problem is that I have to launch a Java application from a JNLP link, what is called Java Web start. The problem is that this feature is not included in the OpenJDK8.
Java Web Start is implemented in the project IcedTea-Web but I cannot find any binaries for macOS and find I try to build it, I obtain the message:
configure: error: "OS darwin18.2.0 is not supported"
My question is : How can I run a JNLP file with OpenJDK 8? Do I need to use IcedTea-Web and if yes how to build it?
Solution 1:
IcedTea-Web is a project that:
provides a Free Software web browser plugin running applets written in the Java programming language and an implementation of Java Web Start, originally based on the NetX project.
but there is no build for macOS. However the important part of this application is written in Java so we can run it directly on macOS. Here is how:
Get the Debian build from the stable release:
wget http://ftp.us.debian.org/debian/pool/main/i/icedtea-web/icedtea-netx-common_1.6.2-3.1_all.deb
Extract the deb file:
tar xzvf icedtea-netx-common_1.6.2-3.1_all.deb
Extract the archive data.tar.xz
which is inside the deb file:
tar xzvf data.tar.xz
Go to the directory where the main jar file is:
cd usr/share/icedtea-web/
and just run your jnlp file:
java -cp netx.jar net.sourceforge.jnlp.runtime.Boot -Xnofork -jnlp my_application.jnlp
Depending on your application you could have to change options. You can list them with:
java -cp netx.jar net.sourceforge.jnlp.runtime.Boot
which result in:
SYNOPSIS
javaws [-run-options] jnlp file
javaws [-control-options]
OPTIONS
When specifying options, the name of the jnlp file can be after the command, the -jnlp option, an option with no arguments, or after an argument with an option that takes one argument. A html file that launches a jnlp can be specified after the -html option.
The jnlp-file can either be a url or a local path.
The JNLP file should only be specified once, whether as a main argument, after -jnlp or through an html file.
Control options:
-about - Shows a sample application.(No argument expected)
-help - Prints out information about supported command and basic usage.(No argument expected)
-license - Display the GPL license and exit.(No argument expected)
-viewer - Shows the trusted certificate viewer.(No argument expected)
-Xclearcache - Clean the JNLP application cache.(No argument expected)
Run options:
-allowredirect - Follows HTTP redirects.(No argument expected)
-arg arg - Adds an application argument before launching.(Expected one or more arguments)
-headless - Disables download window, other UIs.(No argument expected)
-html - Location of HTML file to launch (url or file). You can use parameter ALL or numbers (like 1 2 5) to select applets on page. However experimental, this switch should keep you still in safety.(Expected one or more arguments)
-jnlp - Location of JNLP file to launch (url or file).(Exactly one argument expected)
-nosecurity - Disables the secure runtime environment.(No argument expected)
-noupdate - Disables checking for updates.(No argument expected)
-param name=value - Adds an applet parameter before launching.(Expected one or more arguments)
-property name=value - Sets a system property before launching.(Expected one or more arguments)
-strict - Enables strict checking of JNLP file format.(No argument expected)
-update seconds - Check for updates.(Exactly one argument expected)
-verbose - Enable verbose output.(No argument expected)
-version - Print the IcedTea-Web version and exit.(No argument expected)
-Xignoreheaders - Skip jar header verification.(No argument expected)
-xml - Uses a strict XML parser to parse the JNLP file.(No argument expected)
-Xnofork - Do not create another JVM.(No argument expected)
-Xoffline - Prevent ITW network connection. Only cache will be used. Application can still connect.(No argument expected)
-Xtrustnone - Instead of asking user, will foretold all answers as no.(No argument expected)
Update
In the future, you should be able to use Open Web Start which is an open source reimplementation of the Java Web Start technology. But for now the macOS installation is not ready. Check the corresponding GitHub issue for details.