Develop and Deploy a Java Application with NetBeans

 

Follow these instructions to use NetBeans 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.

Configure NetBeans

Make sure that the "Java Web and EE" plugin is activated:

  • Open NetBeans.
  • Go to Tools > Plugins.
  • Select the "Installed" tab.
  • All "Java Web and EE" entries listed should have a checkmark under the "Active" column. For those that do not, select "Java Web and EE" and click "Activate".
    • The number of "Java Web and EE" entries will vary depending on your operating system.

      NetBeans - Plugins

Name your GlassFish server installation:

  • Go to Tools > Servers > Add Server.
  • Select "GlassFish Server 3".
  • In the "Name" field, enter a name for your server. In this example, we use the name "ThinkQuest".
  • Click "Next".

    NetBeans - Add Glassfish Server Instance

Provide a local installation path for your GlassFish server. In this example, we use "C:\Program Files\GlassFish-3.1":

  • Read and accept the license agreement.
  • Click "Next".

    NetBeans - Accept license agreement

Register your remote domain:

  • Click the radio button next to "Register Remote Domain".
  • In the "Host Name" field, enter your team's OEF Hosted Environment URL. In this example, we use "xxddtjwifeogcqgavnwa.thinkquest.org".
  • In the "Admin Port" field, enter "8787".
  • Click "Finish".

    NetBeans - Add Server Instance

Your server name will display in the server list.

NetBeans - Server list

In the login window, enter the OEF Hosted Environment username and password.

  • If the login window does not appear, right-click on your server name in the server list and click "Refresh".

    NetBeans - Login

After you log in, additional information will appear under your server name (e.g. Applications, Resources, Web Services etc.). GlassFish is now configured.

NetBeans - Server list

Create your Application

Create a new project for your example application:

  • Open NetBeans.
  • Create a new Project. Go to File > New Project.
  • Select "Java Web" under Categories.
  • Select "Web Application" under Projects.
  • Click "Next".

    NetBeans - New Web Application Project

Name your project:

  • In the "Project Name" field, enter a name for your project. In this example, we name the project "HelloWorld".
  • Accept the defaults for the other fields.
  • Click "Next".

    NetBeans - Web Application Name/Location settings

Provide the context path for your project:

  • In the "Server" field, select the GlassFish server you configured.
  • Accept the defaults for the other fields.
  • Click "Next".

    NetBeans - Web Application Server settings

Select the Frameworks you want to use in your application. This example does not use them so none is selected.

  • Click "Finish".

    NetBeans - Web Application Framework settings

A new project will now appear in the project list (Window > Projects).

NetBeans - Project list

Continue to develop code in your project as needed.

Deploy your Application to the OEF Hosted Environment

Open NetBeans and select the project from the project list (Window > Projects).

Build the project:

  • Right-click on your application and click "Build".

Deploy your application:

  • Right-click on your application and click "Run".

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

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