Download NetBeans!

20090422 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:

  1. Design and create your application, with all its modules, and so on. I.e., the next step assumes your application is ready for distribution.

  2. 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/

  3. Right-click the application and choose "Build JNLP Application".

  4. 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.

  5. 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.)

  6. 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.

  7. 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.

  8. 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

Trackback URL: http://blogs.sun.com/geertjan/entry/how_to_deploy_netbeans_platform
Comments:

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 #

Hi
I've read your blog with vaste interest.I am actually looking for deploying a "jnlp appl" and i understand i must buy a licence key do to such application under netbeans 6.8.
I am also studiing your complete web cast.
It would be nice if you could you send me the right link or informations about that licence key?
Best regards
Phil

Posted by biblast on January 19, 2010 at 04:44 AM PST #

License key? Who told you you need a license key? You don't.

Posted by Geertjan Wielenga on January 19, 2010 at 05:20 AM PST #

When i right click on "build jnlp application" i have a error message into the "output":
Warning:
The signer certificate will expire within six months.
Enter Passphrase for keystore:
Signing JAR: D:\Documents and Settings\@propylée.fr\Mes documents\NetBeansProjects\XML_Ed_2010\build\jnlp\branding\org-netbeans-core-windows_app.jar to D:\Documents and Settings\@propylée.fr\Mes documents\NetBeansProjects\XML_Ed_2010\build\jnlp\branding\org-netbeans-core-windows_app.jar as jnlp

Warning:
The signer certificate will expire within six months.
Enter Passphrase for keystore:
suite-jnlp.copy-branding:
Warning: Could not find file D:\Documents and Settings\@propylée.fr\Mes documents\NetBeansProjects\XML_Ed_2010\${app.icon} to copy.
Your JNLP file is generated at D:\Documents and Settings\@propylée.fr\Mes documents\NetBeansProjects\XML_Ed_2010\build\jnlp/master.jnlp

D:\Program Files\NetBeans 6.8 RC2\harness\suite.xml:493: The following error occurred while executing this line:
D:\Program Files\NetBeans 6.8 RC2\harness\jnlp.xml:364: Some tests failed:
D:\Documents and Settings\@propylée.fr\Mes documents\NetBeansProjects\XML_Ed_2010\build\jnlp\app\my-presentation-propylee.jnlp/testParse: Invalid byte 2 of 3-byte UTF-8 sequence.
BUILD FAILED (total time: 6 seconds)
Here it is !
Phil

Posted by biblast on January 19, 2010 at 06:24 AM PST #

Read "Self-Signing jar file with NetBeans Web Start" here:

http://kenai.com/projects/cps/pages/DeveloperFAQ

If you then continue to have problems, don't leave a message here (because I don't know how else to help you and I will therefore ignore subsequent questions on this point that you leave here). Instead, write to dev@platform.netbeans.org and also join that mailing list.

Posted by Geertjan Wielenga on January 19, 2010 at 07:30 AM PST #

We're currently using the 'appClient' feature of Glassfish v2, because our NetBeans app is talking with EJBs. Do you know if we can use the technique described in your post and still somehow get some EJBs injected? We would love to use v3, but seems like the appClient-WebStart support isn't there yet. Thanks!

Posted by Chiss on January 20, 2010 at 10:14 AM PST #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed