Vous êtes sur la page 1sur 12

Develop and Deploy a Java Application with Oracle JDeveloper

Follow these instructions to use Oracle JDeveloper 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.
Java Development Kit 6
Oracle JDeveloper Studio Edition

Create your Application

Open Oracle JDeveloper Studio Edition:
Select Java EE Developer.



Create a new application:
Select New Application.



Select Custom Application.
Click OK.




Name your application:
In the Application Name field, enter a name for your application. In this example, we name the
application HelloWorld.
Click Next.



Name your project:
In the Project Name field, enter a name for your project. In this example, we name the project
HelloWorld.
Select JavaServer Faces(JSF) under Project Features.
Move the selected feature from the Available window to the Selected window using the right arrow
button.
Click Next.



On the next screen, accept the default settings.
Click Finish.



JDeveloper will create and configure the new project. The HelloWorld project will be visible in the Projects
workspace.



Create the welcome page:
Select the Web Content.
Go to File > New.




Select the All Features tab:
Go to Web Tier - > HTML under the Categories list.
Select HTML Page under the Items list.
Click OK.



Create the HTML file. This file is the welcome page for your application:
In the File Index field, enter index.xhtml.
The Directory field will pre-populate.
Place a check in the Create as XML file (*.xhtml) checkbox.



Edit the HTML file:
Open index.xhtml.
Select the Source option to edit the page body.



Enter (or copy/paste) the following example code:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>HelloWorld</title>
</h:head>
<h:body>
Hello World!
</h:body>
</html>

Save the file.

Configure the HTML file as your welcome page:
Open web.xml file from the project file list.
Select the Pages tab.
Click the plus sign + to the right of the Welcome Files section and select the index.xhtml file.
Save the file.


Create the Deployment Profile

Create a new deployment method:
Right-click on the project.
Select Deploy.
Select New Deployment Profile.




On the resulting screen:
From the Profile Type list, select WAR File.
In the Deployment Profile Name field, enter a profile name. In this example, we name the profile
webapp.
Click OK.



On the next screen:
Accept the default components.
Click OK.



Create the WAR File

Deploy to WAR:
Right-click on the project.
Got to Deploy -> webapp.




Select deploy method:
Select Deploy to WAR.
Click Next.



Review the summary screen:
Click Finish.



Use the new WAR file to deploy the application in GlassFish in the next section.

Deploy your Application

Enter the URL for the Oracle GlassFish Server Administration Console. The format for this URL is
https://<OEF Hosted Environment URL>:8787/:
Open a browser.
In the address bar, enter your OEF Hosted Environment URL.
Add a colon : to the end of this URL.
Add the Web Admin interface servers port 8787 followed by a forward slash /.
In this example, the Web Admin URL is https://xxddtjwifeogcqgavnwa.thinkquest.org:8787/.

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



Deploy the application:
Go to Applications.
Click Deploy.




Click the radio button next to Packaged File to Be Uploaded to the Server.
Click Choose file.
Select the desired WAR file.



Make a selection from the Type dropdown list. In this example, we select Web Application.
In the Context Root field, enter the name of the context root for your application. In this example, we
name our context root HelloWorld.
In the Application Name field, enter the name for your application. In this example, we name our
application HelloWorld.
Click OK.




The new application is now added to the Deployed Applications list.




Your application is deployed and can be run in a browser. In this example, the application URL is:
https://xxddtjwifeogcqgavnwa.thinkquest.org/HelloWorld

Vous aimerez peut-être aussi