Sunday, September 19, 2010

Glassfish integration in Eclipse 3.6 (Helios)

Developing in Eclipse for Glassfish is easier when Glassfish is integrated into the IDE. This way, it's possible to right-click the project to deploy the selected project automatically in Glassfish.

In this tutorial, I will show you how to integrate a local Glassfish installation into Eclipse 3.6 (Helios). Before we start, I assume you've installed: Eclipse 3.6, the Java RE, the Java JDK, and the Java EE SDK. Install Java RE and JDK first, before you install the Java SDK.

The first step is to start up Eclipse and locate the servers tab, which is found at the bottom of the screen for default installations.



Now, right-click somewhere in the tab, select "new", and then "server". The following screen will pop up, with the default server adapters.



The server adapter for Glassfish is not included by default. So we have to click "Download additional server adapters" to download the server adapter for Glassfish. A screen will pop up with a selection of server adapters. Select "Oracle Glassfish Server Tools", which is the adapter we're looking for.



Click "next" to download and install the server adapter. Restart Eclipse, when the installation is finished. After the restart, the Glassfish server adapter will show up in the list from the servers tab.



Select it, and click next. The next screen lets you configure the server adapter. Select a working JRE environment and select the installation path of your Glassfish application server.



Click next to go to the next screen. If you have set an administrator password during the installation of Glassfish, you have to fill in this password in the form. Otherwise, use the default values and click next to proceed.



The next screen lets you select existing projects to be added to the newly configured server adapter. The screen is empty in this tutorial, because we're using a fresh install.



When the configuration is succesful, you'll see the server adapter in the servers tab. Now, you can start using it by right-clicking on the server.



From this menu, you can:

  • start/stop the server
  • add/remove new projects
  • publish/unpublish projects
  • view the administration console
  • update Glassfish

Have fun playing with Glassfish in Eclipse!

5 comments:

  1. Tanks for the instructions!!Simple and effective.
    but not define when the user dont have install glassfish, sow it need necessary click the button install server, or go to url download glassfish before follow this tutorial.

    ReplyDelete
  2. I'm not sure what I'm doing wrong, but unfortunately this is not working. All I'm getting when I select the existing Glassfish installation is "There is no valid GlassFish installation in the specified directory." Have you run into this before?

    ReplyDelete
    Replies
    1. Hi Arturo, I'm having the same problem with Eclipse 4.2 (Juno) and GlassFish 3.1.2.2; did you (or anyone else) find a solution?

      Delete
    2. Hi Thorin and Arturo

      Just setup GlassFish 3.1.2.2 with Eclipse 4.2 (Juno). Selecting the directory into which GlassFish has been setup will yield the error message you mention. But selecting the glassfish subdirectory works.

      HTH
      Ole

      Delete
  3. what to do in case of ubuntu12.04

    ReplyDelete