Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Online Training

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
 
Training Index

Writing Advanced Applications
Chapter 9 continued: SolarisTM Operating System

[<<BACK] [CONTENTS] [NEXT>>]

JavaTM Plug-in software lets you direct applets or JavaBeansTM components on intranet web pages to run using the Java Runtime Environment (JRE) instead of the web browser's default virtual machine. The Java Plug-In works with Netscape Communicator and Microsoft Internet Explorer.

Free downloads of all the software you need to install and use Java Plug-In are available from the download page.


Get Downloads

To install and use Java Plug-In on SolarisTM 2.6 or Solaris 7, you need the following downloads. Put the downloads in a directory anywhere you want.
  • Java Plug-In for Solaris operating systems. It is available for either Intel or Sparc platforms.

  • Java Plug-In patches for either Solaris 2.6 or Solaris 7, depending on which one you have.

  • Netscape Communicator 4.5.1 (webstart version).

  • Java Plug-In HTML Converter
These instructions were tested on a Sun Microsystems Ultra 2 running Solaris 2.6 with Netscape Communicator 4.5.1.

Extract Downloaded Files

Go to the directory where you downloaded the files and extract each one.
Extract Java Plug-In Files:
  zcat plugin-12-webstart-sparc.tar.Z | tar -xf -  

Extract Patch Files for Solaris 2.6:
  zcat JPI1.2-Patches-Solaris2.6-sparc.tar.Z | tar -xf -

Extract Netscape Navigator 4.5.1:
  zcat NSCPcom_webstart_sparc.tar.Z | tar -xf -

Install Java Plug-In

The Java Plug-In download includes a user guide that you can view in your browser from the following directory:
  plugin-12-webstart-sparc/Java_Plug-in_1.2.2/
  common/Docs/en/Users_Guide_Java_Plug-in.html 
The user guide explains how to install Java Plug-In. There are several easy ways to do it, and the command sequence below is one quick way that installs Java Plug-In in the default /opt/NSCPcom directory using the pkgadd command:
  su
  <root password>
  cd ~/plugin-12-webstart-sparc
  pkgadd -d ./Java_Plug-in_1.2.2/sparc/Product

Install Java Plug-In Patches

Before you can run Java Plug-In, you have to install the patches. You install the patches one at a time as root. The following command sequence goes to the patch directory, lists the files, and issues the command to install the first patch:
  cd ~/JPI1.2-Patches-Solaris2.6-sparC
  su
  <password>
  kq6py#ls
  105210-19  105490-07  105568-13
  kq6py#./105210-19/installpatch 105210-19
You will see this output when the patch is successfully installed:
  Patch number 105210-19 has beenZ successfully 
    installed.
  See /var/sadm/patch/105210-19/log for details

  Patch packages installed:
    SUNWarc
    SUNWcsu
Continue installing the patches one-by-one until all patches have successfully installed. The user's guide provides a list of required and suggested patches and links to where you can download additional suggested patches if you want to install them.

Install Netscape Communicator

The extracted Netscape Communicator 4.5.1 files provide a user's guide in the /home/monicap/NETSCAPE/Netscape_Communicator_4.51/
common/Docs/en
directory that explains the installation. The following command sequence is one easy way to do it with the pkgadd command. By default, the installation puts Netscape Communicator in the /opt/NSCPcom directory where your Java Plug-In and patches are also installed.

When you extracted the NSCPcom_webstart_sparc.tar.Z download, it placed the files in a NETSCAPE directory. From the NETSCAPE directory, execute the following command sequence:

  cd ~/NETSCAPE/Netscape_Communicator_4.51/sparc/Product
  su
  <password>
  pkgadd -d .

Check the Installation

There are two ways to check your Java Plug-In, patch, and Netscape Communicator installation.
  1. Open the Netscape Help menu and select About Plug_Ins. You will see a list of Mime types. Check this list against the list presented in the user's guide. If your mime types are correct, the installation is correct and complete.

  2. Start the control panel applet by loading the /opt/NSCPcom/j2pi/ControlPanel.html file. If the applet starts, the installation is correct and complete.
The control panel lets you change the default settings used by Java Plug-In at startup. All applets running inside Java Plug-In use these settings.
  cd /opt/NSCPcom/j2pi
  ControlPanel &

Convert HTML Files

ME="convert"

Install the HTML Converter

Your browser will not automatically use the Java Plug-In when you load an HTML file with an applet. You have to download and run the Java Plug-In HTML Converter on the HTML page that invokes the applet to direct the applet ro run using the plug-in instead of the browser's default runtime.

Unzip the Java Plug-In HTML Converter download:

  unzip htmlconv12.zip
Add the HTMLConverter.java program or its directory to your CLASSPATH.

Security Policy File

The auction application uses an applet running in a browser for administrative operations. In the JavaTM 2 platform, applets are restricted to a sandbox-like environment and need permission to access system resources outside their restricted environment. Applets are restricted to read operations within their local directory. All other access operations require permission.

Types of Policy Files

You need a policy file to grant access permissions to the Administration applet. If the applet runs on a disk other than the disk where the browser is running, the applet will also need to be signed. See Signed Applets for information on signing and deploying applets.

There are three kinds of policy files: system, user, and program. The system policy file is located in jdk1.2/jre/lib/security/java.policy or jre1.2/lib/security/java.policy and contains permissions for everyone on the system.

The user policy file is located in the user's home directory. The user policy file provides a way to give certain users additional permissions over those granted to everyone on the system. The permissions in the system file are combined with the permissions in the user file.

A program policy file can be located anywhere. It is specifically named when an application is invoked with the java command or when an applet is invoked with applet viewer. When an application or applet is invoked with a specific policy file, the permissions in that policy file take the place of (are not combined with) permissions specified in the system or user policy file. Program policy files are used for program testing or intranet deployment of applets and applications.

Installing the Policy File

Place the security policy file in your home directory and name it .java.policy. When the applet tries to perform an action that requires a policy file with a permission, the policy file is loaded from this directory and remains in effect until you exit and restart the browser.

If an applet tries to perform an access operation without the right permission, it quietly quits without raising either an applet or a browser error.

Changing the Name or Location

You can change the name and/or location of the default system or user policy file. Edit the jdk1.2/jre/lib/security/java.security or jre1.2/lib/security/java.security file and add a third entry specifying the name and location of an alternative policy file.
  policy.url.1=
    file:${java.home}/lib/security/java.policy
  policy.url.2=file:${user.home}/.java.policy
  policy.url.3=file:/<mypolicyfile path and name>

Run the Administration Applet

Copy the Java Archive (JAR) file with the Administration applet and policy file to its final location. In this example, that location is the /home/zelda/public_html directory. Next, extract the applet class file and policy file from the JAR file:
  cp admin.jar /home/zelda/public_html
  jar xf applet.jar
The extraction places the policy file under public_html and creates an admin directory under the public_html directory with the applet class file in it. Rename the policy file in the public_html directory to .java.policy and copy it to your home directory.

In the public_html directory, create an HTML file that invokes the Administration applet class. Be sure to include the admin directory when you specify the applet class to the CODE option. Note that when using Java Plug-In, you cannot have the browser load the class file from the Java Archive (JAR) file.

<HTML>
<BODY>
<APPLET CODE=admin/AdminApplet.class
  WIDTH=550
  HEIGHT=150>
</APPLET>
</BODY>
</HTML>
Start the HTML Converter.
  java HTMLConverter
In the HTML Converter graphical user interface, select One File:, specify the path to the admin.html file, and click the Convert button.

After the conversion completes, load the admin.html file in your browser.

[TOP]


[ This page was updated: 14-Oct-99 ]

Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary - Applets - Tutorial - Employment - Business & Licensing - Java Store - Java in the Real World
FAQ | Feedback | Map | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-99 Sun Microsystems, Inc.
All Rights Reserved. Legal Terms. Privacy Policy.