Working With Eclipse and Glassfish

With the new launch of Java EE 7, I felt the quickest way to get a taste of it is to use Glassfish (Java EE reference implementation). Here’s how to get started with Glassfish and Eclipse:

Eclipse GlassFish Setup

  1. Download and install JDK 7 if you haven’t done so.
    jdk download

  2. Download and install Glassfish 4.0
    glassfish download
  3. Ensure you have Eclipse installed. First we’ll add Glassfish runtime environment. On Eclipse, go to Preferences -> Server -> Runtime Environments -> Add and select Glassfish -> Glassfish 4.0 (Select Download additional server adapter if you can’t find it).

    eclipse glassfish 01

    Hit Next, select Java 7 runtime and glassfish directory (On windows this is normally C:\glassfish4\glassfish)

    glassfish eclipse setup 1

  4. Next, create a new Glassfish server. Ctrl+N (or Cmd+N on Mac) and select Server -> Server. Select server type GlassFish -> GlassFish 4.0. Accept all defaults and hit Finish. You should now have a Glassfish server on your Servers tab on eclipse:

    eclipse glassfish 2

  5. To test your server, select the Glassfish 4.0 Server from Eclipse server tab and right click -> Start. Glassfish server will output few messages to the console, and you can verify by opening http://localhost:8080 on your browser, you will see something like this:

    glassfish server running

    Right click the server -> Stop to stop the server.

Create New Glassfish Application Project

Now we have eclipse wired to Glassfish, we can begin coding the application.

  1. Create a new dynamic web project: Ctrl+N (or Cmd+N on Mac) -> Select Web -> Dynamic web project. Configure it like following:
    Screen Shot 2013-06-29 at 2.46.42 PM

    Accept all default (or configure if you need to) and hit Finish

Advertisements

2 thoughts on “Working With Eclipse and Glassfish

  1. Pingback: Proper Oracle Java, Database and WebLogic support in Windows Azure including pay-per-use licensing via Microsoft + the same Oracle software supported on Microsoft Hyper-V as well | Experiencing the Cloud

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s