====== Fix JNLP Support in Firefox ====== ===== Intro ===== So I couldn't get a JNLP file to open correctly through [[wp>firefox|Firefox]] in Linux. Clicking on a ''.jnlp'' file on a web page would just bring up the download dialog instead of actually opening Java WebStart. This was pissing me off to no end. I finally had some time and the need to get this working so I dug in and figured out how to fix this. Follow the steps below and you should be up and running as well. ===== Check for the Java Plugin ===== The first thing that needs to be done is to check for the existence of a Java plugin in your browser. This, thankfully, is a simple task. First, open Firefox (obviously) and open a tab. Type ''about:plugins'' in the tab and hit Enter. This will show you a listing of all the plugins your browser can currently use. It should look something like the following: {{apps:firefox:java_plugin.png|}} If you see a Java plugin, you should be good to go to move on to the next step. If not, make sure that you have Java installed and that plugin file, ''libjavaplugin_oji.so'' is in your plugins directory. This varies depending on your linux platform. ===== Open Your Profile's Mimetypes File ===== In your home directory, you should have a hidden directory named something like ''.mozilla'', ''.firefox'' or ''.mozilla-firefox''. On my [[http://gentoo.org|Gentoo]] boxes, it's ''.mozilla''. Open that directory. On my [[http://gentoo.org|Gentoo]] box, there is a directory in there called ''firefox''. If you are using a distro where you have a ''.firefox'' or ''.mozilla-firefox'' directory in your home directory, you probably won't see this. Now open that ''firefox'' directory (if you have it). In this directory you should something like this: $ ls -l total 13 drwx------ 7 jdeiman jdeiman 1192 May 11 10:57 g8mizwd9.default -rw------- 1 jdeiman jdeiman 8093 May 11 10:36 pluginreg.dat -rw-r--r-- 1 jdeiman jdeiman 94 Feb 27 12:25 profiles.ini What we are interested in here is the ''.default'' directory which is your default user profile. In this case, ''g8mizwd9.default''. Open that directory. In this directory there are a number of files and directories. The file we are interested in is ''mimeTypes.rdf''. Open this file in your favorite text editor. You should notice quickly that this is just an [[wp>xml|XML]] document. Now search the file for //jnlp//. Hopefully, you already have an entry in here for jnlp files, but it is just misconfigured. If you don't find a line like the next block, skip down to [[#Adding All the JNLP Entries]], otherwise just continue on from here. Ok, so you have a reference to the mime type for jnlp files, it's just not setup correctly. If you scroll down near the bottom of the file, you should see a section like this: The main thing you are looking for is the attribute ''RDF:about="urn:mimetype:externalApplication:application/x-java-jnlp-file"''. There are a couple other sections that look similar to this, so make sure you have the right one. What I did, was copy this section, paste it right below the original and then comment out the original in case I made a mistake. That way I could just delete my change and uncomment the original and be back to square one. This change should look like the following: The next step is finding out where your ''javaws'' binary is. This is going to vary quite a bit between distros, but hopefully it should be an easy thing to find. I just opened a terminal window and ran a ''which'' command: $ which javaws /usr/bin/javaws If the binary is in your path, you should get something similar to that for a response. If not, you can try to find it using ''locate'' or possibly : $ find /usr -name 'javaws' -print That will search ''/usr'' for the file, which is sometimes in ''libexec'' or some other place. Once you've found the full path to the file, the rest is easy. Just change the ''NC:path'' and ''NC:prettyName'' in that new section we made in ''mimeTypes.rdf''. It will end up looking like this (providing ''javaws'' is in ''/usr/bin''): Now, save the file, restart Firefox, and try it out somewhere like here: [[http://java.sun.com/products/javawebstart/demos.html]] ===== Adding All the JNLP Entries ===== If you didn't have any reference to the JNLP mime type in ''mimeTypes.rdf'', we are going to have to create them all. I would highly recommend **BACKING UP YOUR ORIGINAL FILE** before proceeding. $ cp mimeTypes.rdf mimeTypes.rdf.bak First off, I will show you my entire ''mimeTypes.rdf'' file and then we will concentrate on the specific changes that need to be made. Ok, so, to start, you need to add the following line in the section '''': After that section, specifically after the line, '''', we need to add the following: Below that, add this: Almost done, one more section to add: You should be able to save the file, restart Firefox and test out the changes at some place like [[http://java.sun.com/products/javawebstart/demos.html]] ~~DISCUSSION~~