0% found this document useful (0 votes)
54 views21 pages

Les 18

Uploaded by

rksesh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views21 pages

Les 18

Uploaded by

rksesh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 21

Deploying Java Applications

Copyright 2009, Oracle. All rights reserved.

Objectives
After completing this lesson, you should be able to do the following: Package programs in .jar files Describe the benefits of using Java Web Start Deploy an application using Java Web Start

18 - 2

Copyright 2009, Oracle. All rights reserved.

Packaging and Deploying Java Projects


Java supports an archive file that can be used to group all project files in a compressed file. This single file can be deployed on an end users machine as an application. It can also be downloaded to a browser in a single HTTP transaction.

18 - 3

Copyright 2009, Oracle. All rights reserved.

Deploying a .jar File


You can make your simple archive into an executable .jar file that you can launch with the java command. Before deploying an executable .jar file, you must first create a deployment profile. Deployment profiles are named sets of properties stored as part of the application or projects properties that govern the deployment of a project or application. A deployment profile specifies the format and contents of the archive file that will be created.

18 - 4

Copyright 2009, Oracle. All rights reserved.

Deploying Applications with JDeveloper


The JDeveloper Deployment Profile wizard: Detects interclass dependencies Creates .ear, .war, .jar, or .zip files Enables you to have control over other files added to the deployed archive Enables you to save deployment profile settings in project files:
That simplify redeployment when code changes That can be automatically updated with new classes as they are added to the project

18 - 5

Copyright 2009, Oracle. All rights reserved.

Creating the Deployment Profile


1. Select File > New. 2. In the New Gallery, select Deployment Profiles in the General category, and JAR File in the Items pane. 3. Click OK.

18 - 6

Copyright 2009, Oracle. All rights reserved.

Creating the Deployment Profile


Name the deployment profile.

18 - 7

Copyright 2009, Oracle. All rights reserved.

Selecting Files to Deploy


Select the file types to include. This process is called Configuring.

18 - 8

Copyright 2009, Oracle. All rights reserved.

Creating and Deploying the Archive File


1. Right-click the project name. 2. Select Deploy > [profile name] > to JAR file.

18 - 10

Copyright 2009, Oracle. All rights reserved.

Creating an Executable .jar File


Set the Main Class field to the class name containing a main()method in JAR Options.

18 - 11

Copyright 2009, Oracle. All rights reserved.

Java Web Start


Is an application-deployment technology based on the Java 2 platform. Launches full-featured applications via any browser on any platform, from anywhere on the Web.

18 - 13

Copyright 2009, Oracle. All rights reserved.

Advantages of Web Start


Is as easy to deploy as HTML Launches applications from the Start menu on the desktop Does not require browser to be running Allows applications to work offline Automatically updates applications when invoked

18 - 14

Copyright 2009, Oracle. All rights reserved.

Running a Web Start Application


1. Request the application. 2. Launch Web Start on the local machine. 3. Download the application. 4. Launch the application (Draw).

HTTP

3 HTTP 4

18 - 15

Copyright 2009, Oracle. All rights reserved.

Examining the JNLP File


The JNLP file defines: The location of the application resources Information that appears while the application loads What the application resources are

18 - 16

Copyright 2009, Oracle. All rights reserved.

Using JDeveloper to Deploy an Application for Java Web Start


Step 1: Generate deployment profiles and archive the application. Step 2: Start the WebLogic server. Step 3: Use Web Start Wizard to create a JNLP file. Step 4: Archive and deploy your application to the WebLogic server.

18 - 17

Copyright 2009, Oracle. All rights reserved.

Step 1: Generate Deployment Profiles and Application Archive


Package all the Java application files into a simple .jar archive.

18 - 18

Copyright 2009, Oracle. All rights reserved.

Step 2a: Start the Server


Select Run > Start Server Instance to start WebLogic Server.

A connection to the server is automatically created in the Resource Palette.

18 - 19

Copyright 2009, Oracle. All rights reserved.

Step 2b: Test the Connection


To view details of the connection and test it: Right-click the connection name and select Properties. Check the automatically generated properties, and then click the Test tab. Click the Test Connection button.

18 - 20

Copyright 2009, Oracle. All rights reserved.

Step 3: Use the Web Start Wizard to Create a JNLP File


To invoke the Web Start wizard: Select Deployment Descriptors > Java Web Start (JNLP) Files.

18 - 21

Copyright 2009, Oracle. All rights reserved.

Step 4: Archive and Deploy the Application to the WebLogic Server


Specify properties of the Web components and deployment description.


18 - 22

Deploy to the server connection described in step 2. Run the generated HTML file.
Copyright 2009, Oracle. All rights reserved.

Summary
In this module, you should have learned how to: Create an executable .jar file containing your application Describe the role of Java Web Start in deployment and outline the benefits of using it Describe how a Java Web Start application runs Use JDeveloper to deploy an application using Java Web Start

18 - 23

Copyright 2009, Oracle. All rights reserved.

You might also like