I promised to configure a laptop to a friend of mine, who needed to run one Java-based application on it. Little did I know, what I had promised. My idea was to install Ubuntu 18.04 and OpenJDK and be done with it.
When my plan was implemented in reality and it was time for the first test, I noticed there was only a big white window on the screen. We decided to RTFM and found the instructions. They recommended using Windows XP and Oracle's Java.
I installed Oracle's Java 11 (the latest LTS release for the time being) according to these instructions. Everything went as instructed, but I couldn't do anything to JNLP file the application gave to me. I knew I needed to run it with Java Web Start. Further research revealed that Oracle had deprecated Java WS and my best option was running an older Java release despite the security holes coming with it.
Here's how I got my setup working. If you want to follow along, please note what I said above about old Java releases and their security holes.
The first thing to do is install Oracle JDK, version 8. Here is the download link. As we are using Ubuntu, download the tar.gz file. If you are copy-pasting the commands, please note that you have to modify the paths according to your system, change at least the version number as that will most likely differ from my setup.
Create a directory where to extract Java:
sudo mkdir -p /usr/lib/jvm
Change to the directory:
Extract the Java to the directory and remember to adjust the paths according to your version of Java:
sudo tar -zxvf ~/Downloads/jdk-8u221-linux-x64.tar.gz
Then the environment variables have to be added so that the system can find the Java:
sudo gedit /etc/enviroment
Add the following bin folders to the existing PATH variable:
Note the semicolons that have to separate the paths. Remember to put one between the original and the paths you are appending, too. Once again, modify the paths according to your Java version.
You need to add some other environment variables after the path:
When modified, the file should look something like this:
Then we will configure Java locations for Ubuntu:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_221/bin/java" 0
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_221/bin/javac" 0
sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_221/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/jdk1.8.0_221/bin/javac
Verify that the locations are correct:
update-alternatives --list java
update-alternatives --list javac
Log out, back in and then test that you get the correct Java version with command:
Once that works, the last step is to get the browser use your just installed Java WS. You should see Java WS binary in:
When using Firefox, go to settings and set it to open JNLP files with the javaws binary.
Next time you open a JNLP file in browser, you should see it opening up within Java WS window.