Develop and Deploy a Java Application with Eclipse

 

Follow these instructions to use Eclipse to develop and deploy your Java application to the OEF Hosted Environment.

Before you begin:

  • Obtain your OEF Hosted Environment URL, username, and password from your coach.
  • Make sure you have unrestricted Internet access and that proxy servers or firewalls are not blocking access to the below-noted resources.

Install the Software

Download and install the following software. Accept the default components for each install.

Install the Oracle GlassFish Adapter

Open Eclipse and add a server:

  • Open Eclipse.
  • Go to Window > Show View > Servers.
  • Go to File > New > Other.
  • Select "Server" from the list of Wizards.
  • Click "Next".

    Eclipse - New Server

Install the Oracle GlassFish Server Tools:

  • Click on "Download additional server adapters" to add GlassFish to the list of server types.

    Eclipse - Download additional server adapters
  • A list of adapters will be displayed. Select "Oracle GlassFish Server Tools".
  • Click "Next".

    Eclipse - Oracle GlassFish Server Tools
  • Read and accept the license agreement.
  • Click "Finish".
  • Restart Eclipse when prompted.

Configure Eclipse

Choose a New Server:

  • Open Eclipse.
  • Go to Window > Show View > Servers.
  • Go to File > New > Other.
  • Select "Server" from the list of Wizards.
  • Click "Next".

    Eclipse - New Server

Select GlassFish 3.1 as the server type:

  • In the "Server's host name" field, enter your team's OEF Hosted Environment URL. In this example, we use "xxddtjwigeogcqgavnwa.thinkquest.org".
  • From the "Server runtime environment" list, select "GlassFish 3.1".
  • Click "Next".

    Eclipse - Configure Glassfish Server

Set the path for the local install of GlassFish:

  • The default path for Windows is C:\Program Files\GlassFish-3.1.
  • The "Next" button is available only after providing a valid path.
  • Click "Next".

    Eclipse - Configure Glassfish Server JRE

Provide username/password and port numbers:

  • Enter the OEF Hosted Environment username and password.
  • For the "Admin Port" field, enter "8787".
  • For the "Server Port" field, enter "443".
  • To test your connection, click "Ping Server". If the connection is not successful, make sure you have entered all the data correctly. If the problem persists, contact competition_support@thinkquest.org.
  • Click "Finish".

    Eclipse - Configure Glassfish Server Admin account and ports

Create your Application

Open Eclipse and go to File > New > Project:

  • Go to Web > Dynamic Web Project.
  • Click "Next".

    Eclipse - Dynamic Web Project

In the "Project Name" field enter a name for your project. In this example, we name the project "HelloWorld".

Eclipse - Name Project

Ensure that the default configuration is using GlassFish.

  • Click "Next".

    Eclipse - Project Glassfish settings

Review the module settings. The fields will pre-populate.

  • Click "Finish".

    Eclipse - Web Module settings

The New project will be available in the project list.

Eclipse - Project list

Deploy your Application in the OEF Hosted Environment

Open Eclipse:

  • View the Project List (Window > Show View > Project Explorer).

Run the HelloWorld Application:

  • In the "Project Explorer", click on your project name.
  • Go to Run > Run As > Run on Server. The following screen will appear.
  • Select the server you configured. In this example, our server is "GlassFish 3.1" followed by our OEF Hosted Environment URL.
  • Click "Finish".

    Eclipse - Run Project on Server

Your application is deployed and can be run in a browser. In this example, the URL is:

  • https://xxddtjwifeogcqgavnwa.thinkquest.org/HelloWorld