Tutorials to .com

Tutorials to .com » Jsp » Xml » Learn to how to use Java Web Start application deployment

Learn to how to use Java Web Start application deployment

Print View , by: iSee ,Total views: 7 ,Word Count: 949 ,Date: Mon, 20 Apr 2009 Time: 10:49 PM


The deployment of java Web Start is a java TM technology-based applications a new technology. It is the connection of computers and easy Internet channels, so that users can run and manage Web applications. Java Web Start to provide an easy point to activate the application and to ensure that is always running the latest version to eliminate the complexity of the installation or upgrade process.

I think the jws very simple, basically there is no need for additional school programmers what is going to write a long document jnlp it. First set up my environment to be Description:

Tomcat4

Download Address: http://jakarta.apache.org/site/binindex.html

JavaWebStart1.0.1_02 (build b03)

Download Address: http://java.sun.com/products/javawebstart

JNLP Developer's Pack

Download Address: http://java.sun.com/products/javawebstart/download-jnlp.html

The following steps to set up procedures to run jnlp support, configured Tomcat to a new virtual directory named myjnlp it, following the establishment of app, images subdirectory. Write a MyIE.java, function is to enter a url, you can open the url. Process is in fact very small part of the jnlp. Source as follows:

import java.awt .*;
import java.awt.event .*;
import java.io. *;
import java.lang .*;
import java.applet .*;
import javax.swing .*;
import javax.jnlp .*;

public class MyIE
(
BasicService bs;
JFrame jFrame;
TextField tField;
Button button;

public MyIE ()
(
jFrame = new JFrame ( "MyIE Browser");
tField = new TextField
( "http://www.google.com");
button = new Button ( "? ˉ àà");

Container p = jFrame.getContentPane ();
p.setLayout (new BorderLayout ());
p.add (button, BorderLayout.EAST);
p.add (tField, BorderLayout.CENTER);

button.addMouseListener (new MouseAdapter ()
(
public void mousePressed (MouseEvent e)
(
try (
bs.showDocument (new
java.net.URL (tField.getText ()));

/ / Open the link) catch (java.net.
MalformedURLException exp)
(
exp.printStackTrace ();
)
)
));
jFrame.addWindowListener
(new WindowAdapter ()
(
public void windowClosing
(WindowEvent e)
(
jFrame.setVisible (false);
System.exit (0);
)
));
jFrame.pack ();
jFrame.setSize (400,80);
jFrame.setVisible (true);

try (
bs = (BasicService) ServiceManager.
lookup ( "javax.jnlp.BasicService");

/ / Find the basic service interface jnlp.
) catch (UnavailableServiceException e)
(
bs = null;
) Catch (Exception e)
(
bs = null;
e.printStackTrace ();
)
)

public static void main (String args [])
(
MyIE myie = new MyIE ();
)
)

Write a jnlp file naming for the MyIE.jnlp (or other, but I would like to end jnlp), this is a descriptive document.

<? xml version = "1.0" encoding = "UTF-8"?>
<jnlp codebase =
"http://liaoyuan:8080/myjnlp/app">
<information>
<title> MyIE </ title>
<vendor> RookieSoft Corporation </ vendor>
<description> MyIE just demo how to
program with jnlp. </ description>
<homepage href = "http://liaoyuan:8080
/ myjnlp / app / index.html "/>
<icon href="./../images/rookie.gif"/>
<icon kind = "splash" href =
"./../ images / logo.gif "/>
<offline-allowed>
</ information>
<resources>
<j2se version="1.2+"/>
<jar href="MyIE.jar"/>
</ resources>
<application-desc
main-class = "MyIE" />
</ jnlp>

Save the file to the app directory. Compiler MyIE.java (need JNLP Developer's Pack of jnlp.jar;) package the class files to produce MyIE.jar, and MyIE.jar directory saved to the app. List.html the establishment of a document, save it to app directory.

<! DOCTYPE HTML PUBLIC
"- / / IETF / / DTD HTML / / EN">
<html>
<head>
<title> Remote Apps Webpage </ title>
</ head>

<body>
<h1> Remote Apps Webpage </ h1>
<ul>
<li> <a href="MyIE.jnlp"> MyIE </ a>
</ ul>
<hr>
<address> <a href =
"mailto: rookieport@hotmail.com">
Rookie </ a> </ address>
</ body>
</ html>

1) Start your tomcat visit list.html, points can be connected MyIE running.

2) or to start your JavaWebStart, in their paper menu ----> Preferences ---> Advanced ----> application to delete the text box, enter the URL of the link list.html.

I was http://liaoyuan:8080/myjnlp/app/list.html, in accordance with established procedures for remote application point of view can see out MyIE in which can be run.


Java and XML Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.