Tuesday, January 31, 2012

How to let Google Chrome automatically handle Java Web Start in Ubuntu

A previous post describes a way to run TopCoder Arena without launching from browsers. This post gives another way to launch Topcoder Arena in Google Chrome browser under Ubuntu. It should work for other Java Web Start applications, too.
  1. Intall the latest sun java 6 and browser plugins by following the instructions here.
  2. Set JAVA_HOME and PATH in ~/.profile. An example is the following
    export JAVA_HOME="/usr/lib/jvm/jdk1.6.0_31"
    export PATH="$JAVA_HOME/bin:$PATH"
  3. Install the mime type for "jnlp" files. In the terminal, type
    xdg-mime install $JAVA_HOME/jre/lib/desktop/mime/packages/x-java-jnlp-file.xml
  4. Install the desktop file for "jnlp" files. In the terminal, type
    cp $JAVA_HOME/jre/lib/desktop/applications/sun-javaws.desktop ~/.local/share/applications/
    And make sure it contains the following line
    Exec=javaws %u
  5. Relate the mime type and the desktop file. Add the following line to ~/.local/share/applications/mimeapps.list
  6. Configure Google Chrome browser to open the "jnlp" files automatically after downloading. Download any jnlp file in Google Chrome browser, and select "always open files of this type" in Google Chrome.


Anonymous said...

Excellent!! This really help me!

Anonymous said...

Thanks you

Anonymous said...

My JDK doesn't have a desktop directory in the lib directory. I believe I installed the correct version, correctly. Any idea where I went wrong?

Asad said...

I have the same problem as anonymous above. No desktop directory under lib.
Any ideas?

Anonymous said...

Just for anyone who struggles. The desktop folder isn't in the jdk's lib folder but in the jre's lib folder (as it says .../jre/lib/desktop...)

César Ponce said...

try this
xdg-mime install $JAVA_HOME/lib/desktop/mime/packages/x-java-jnlp-file.xml
same for the others...