Wednesday April 22, 2009
How to Deploy NetBeans Platform Applications to GlassFish
Here's a quick overview of Java Web Start in the context of NetBeans Platform applications, via GlassFish:
- Design and create your application, with all its modules, and so on. I.e., the next step assumes your application is ready for distribution.
- Add this line to the "NetBeans Platform Config" of the application (i.e., its platform.properties):
jnlp.platform.codebase=http://bits.netbeans.org/6.5/jnlp/
- Right-click the application and choose "Build JNLP Application".
- Now in the application's "dist" folder, i.e., visible in the Files window, you'll see a WAR file:
The WAR file will not include a 'netbeans' folder, which would normally be there, including a very long list of subfolders with NetBeans JAR files, for each of the NetBeans Platform modules, because of the jnlp.platform.codebase property above.
- Now take that WAR file and put it in the GlassFish glassfish/domains/domain1/autodeploy folder. (I do so via the Favorites window, but use any approach you like, maybe a build script for example.)
- Next, go to the Services window in NetBeans IDE and refresh the GlassFish node by right-clicking it and choosing "Refresh". In the "Applications" folder you will now see a new node for the application created by dropping the WAR file into the "autodeploy" folder.
- Right-click the application node and choose "Open in Browser". There, click "master.jnlp", which is one of the links on the page:
The above includes a "netbeans/" link, which is only shown if the property described above has NOT been set. Therefore, to verify that everything is as expected, i.e., you're using the 'bits.netbeans.org' location for hosting the NetBeans Platform JARs, you should see this instead:
Ether way, clicking the "master.jnlp" link should result in your application deploying via Java Web Start.
- You probably want the above page to look friendlier, so drop an "index.html" page into the "build" folder that is generated via the "Build JNLP Application" described above:
The index.html file should contain a line like this:
<a href="master.jnlp">Launch the application</a>
Now click "Build JNLP Application" again and the content of your "build" folder will be turned into your WAR file (i.e., in the "dist" folder, exactly as before), which will now include your index.html file.
Then replace the old WAR file on GlassFish with your new one, which should result in the launcher link being displayed in the browser, together with whatever else you included in the index.html file:
Also, because of the above property in the platform.properties file, all the relevant NetBeans modules will be downloaded, which therefore will not need to be done again for any other application using those modules.
Apr 22 2009, 10:58:55 AM PDT Permalink
So if you don't want to rely on bits.netbeans.org you would have to host that yourself?
Posted by 12.30.196.14 on April 22, 2009 at 11:33 AM PDT #
Exactly, 12.30.196.14.
Posted by Geertjan on April 22, 2009 at 11:36 AM PDT #


