X

Geertjan's Blog

  • July 11, 2011

Installing GlassFish via an Application's Installer

Geertjan Wielenga
Product Manager

In Installing the JRE via an Application's Installer, there's info on including the JRE in the installer for your NetBeans Platform application. Let's now do something related, which is to install GlassFish together with our application. I know of several NetBeans Platform developers interested in this topic and I'm guessing that Tim from CoreFreight is one of these!

Anyway, by the end of this blog entry, you'll know how to let the user of your app end up with all of this in their install dir once they've worked through the installer:

In other words, there'll be a private installation of GlassFish in the application installed via the NetBeans Platform installer you provide.

Do the following:

  1. ZIP up your installation of GlassFish. I.e., somewhere on disk, you should have GlassFish installed. Remove any domain folders you have there since the procedure that follows will result in a "domain1" automatically being created at the time when the installer finished. Note that if you have some custom libraries that GlassFish will need, just include them in the appropriate folders in GlassFish before you ZIP it up. I.e., you're going to be providing, if you like, a custom GlassFish distribution tailor made for the application you've created. Otherwise, just ZIP up the default standard GlassFish and the user will have that when they complete the installer. The ZIP that you have will be unzipped and packed into the installer once you choose "Package as | Installers" in the IDE.

  2. Check out the NetBeans sources. Working with the NetBeans installer infrastructure is not easy, so being able to look at its sources will be helpful. Also, NetBeans IDE itself also ships with GlassFish, hence we're going to copy some code from the NetBeans sources so that we can reuse them rather than writing our own code. Here are the instructions for checking out the NetBeans sources.

  3. Extend the IDE's "harness" directory. Currently, the "harness/nbi" folder in your NetBeans IDE installation is the single place where you can define your installation infrastructure. That means that this installation infrastructure will be used by each and every application for which you run "Package as | Installers". Not very convenient, i.e., would be better if there was such a folder for each application separately, but that's the way it is right now. So, anyway, within "harness/nbi", you now need to create a "components" folder for GlassFish, as well as an "infra" folder, as you can see below in the screenshot:

    Now, the question is, what exactly should go into those two folders that you see highlighted above? In the case of the "components" folder, just go to the NetBeans sources, which you downloaded earlier, and copy the folder "installer/components/products/glassfish". In the case of the "infra" folder, do the same, i.e., copy the equivalent folder from the NetBeans sources.

  4. Tweak. Now you've got some tweaking to do in the files you copied. For example, in my "build.properties" (within the "infra" folder), I have these lines which will pull the content of the ZIP file into the installer:

    product.data.length=1
    product.data.1.zip=true
    product.data.1.path=/home/geertjan/GlassFish_Server/GlassFish3.zip

    Do a search and replace in all the files you copied and try and read through everything carefully, so that you end up with files tuned for your scenario.


  5. Include the GlassFish Product in the Build Process. Open "nbi/stub/build.xml" and add the line in bold below to the "create-bundle" task:

    <create-bundle root="${output.dir}/registry-temp" 
    platform="${platform}"
    target="${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}">
    <component uid="${main.product.uid}" version="1.0.0.0.0"/><component uid="glassfish" version="1.0.0.0.0"/>
    </create-bundle>

    The text "glassfish" in the target above should match the value of "product.uid" in nbi/stub/ext/infra/build/products/glassfish/build.properties.

Probably this all won't work the first time, but tweak a bit more, based on the messages in the Output window, and in the end, you should end up with success. Anyway, it works for me, so if anyone is having a problem with this particular scenario, I should be able to help. When the user starts the installer, they'll be prompted where to install the app, but also where to install GlassFish. Then not only the app, but also GlassFish will be installed into the specified location.

Thanks to Dmitry Lipin for help with this scenario.

Join the discussion

Comments ( 4 )
  • guest Tuesday, July 12, 2011

    Hi Geertjan

    This is definitely very interesting news.

    I'm looking into moving all our peripheral applications onto the NetBeans platform, and that could definitely use the bundled glassfish installer.

    Thanks for the tip!


  • guest Monday, January 30, 2012

    Thanks a lot. Please could you help me with the process of making an installer for my j2ee app that will make sure glassfish, mysql, jdk, and the ear files are all installed. Thank you.


  • guest Monday, January 30, 2012

    An installer for a "j2ee app"? What does that mean? You mean an application on the NetBeans Platform? Because if you don't mean that, then you're in the wrong place and I'm not going to be able to help you.


  • Application Management Software Thursday, August 9, 2012

    the end of this blog entry, you'll know how to let the user of your app end up with all of this in their install dir once they've worked through the installer:


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services