Search code examples
javaeclipseeclipse-pluginjnlp

How To Export to JNLP in Eclipse


I watched today as someone painlessly exported a NetBeans java project to a JNLP file and HTML file that he could just copy to his web server. Making JNLP files by hand is slightly obnoxious, especially given the codebase parameter. I would love if I could do the same in Eclipse, but I can't seem to find such a function or a plugin which does this.

The only thing I've found is this article but I can't really parse it, it's a bit dense to me, for instance it mentions:

Ensure that the org.eclipse.equinox.launcher plug-in is in the feature or in one of the included feature;

But if that's even a grammatical sentence, I don't know how to ensure what it says.


Solution

  • Edit April 2024: This is a very old answer, but someone let me know the link to the PHP script is broken, so I updated it to point to the Wayback Machine. The PHP source appears to still be downloadable from them (amazing!) but the code is really pretty straightforward and you can probably just re-implement what it's doing without too much work. Feel free to use it as a reference, of course.


    Since I never did find an easy way to do it in Eclipse, I did one better, and made JNLPs easy to use on your server! I took the time to figure out the different little quirks that were confusing me, and decided that the necessity to manually specify an absolute codepath is obnoxious. So I wrote a PHP class which generates your JNLP file for you, so that you don't need to worry about the XML at all, and even better, you can use the exact same PHP file on a development server and a live server, or move it around, or whatever you'd like. It updates the codebase dynamically. Solved my problems.