Saturday, 30 November 2013

Running jnlp ( java webstart ) files on linux [ubuntu]

Few days back, I had to use a plagiarism detection software , known as JPlag , for some obvious reasons. The client program for jplag is available as JNLP file.

I was previously a windows' user ( currently running linux ) so my expectations were that  I only had to click on that file ( after download ) to run it. But, unfortunately that wasn't the case.
As I have switched to ubuntu 12.04 and I had no plans for installing Windows on my system again. So I had to search for a solution .

In an ideal scenario the following command in the linux terminal would suffice.

> javaws <filename>
I tried this command but it seemed like the file was not on my system. This raised some doubts, in my mind, about the java ( jre/jdk ) installation. After checking everything , I concluded that the java installation was working fine and it was only the JAVA WEBSTART that was missing. For some reason it was not included in "java-7-openjdk-amd64".

As always , Oracle online documentation and other facilities proved themselves useless in providing some help. I was trying to download the so called java web start zip file that they mentioned in one of their documentation pages. But there was no such file available stand alone for download.

Well , after Googling , a bit more , I found this link that provided me with some lead and I finally found Ice Tea Java WebStart . I installed it on my system and again tried the same command but it didn't work. The error was that it was unable to find java. I instantly ran this command

> sudo nano `which javaws`


and changed this line

JAVA=/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 
to 

JAVA=/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java

where /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java is the path to my java installation. You can simply write java instead of the whole path if you can run java -h on linux terminal i.e. path to java is included in PATH variable.
After these changes , everything worked like a charm.