HP Netstation Software 9.0 includes a Java Runtime Environment (JRE) that lets you run any Java program that conforms to the 100% Pure Java specification.
For more information about how to use the Java Runtime Environment, refer to the following sections:
You can run third-party Java programs or develop your own. To develop your own Java programs, you need a Java Development Kit, such as the JDK 1.1.2 for HP-UX.
For information about Java products in general,
open the following location from a web browser:
www.javasoft.com
.
For every Netstation that will run Java programs, review the following configuration steps.
include $(NsRoot)/Java_1.1.2/config/java.cfg
By default, this line is included in HP Netstation Software 9.0 remote configuration files.
For more information about remote configuration, see Using Remote Configuration.
include $(NsRoot)/Java_1.1.2/bin/java.directives
By default, this line is included in HP Netstation Software 9.0 directives files.
For more information about directives files, see Customizing the directives File.
http://www.javasoft.com/products/jdbc/jdbc.drivers.html
There are several ways to launch a Java program through the HP Netstation Software Java Runtime Environment:
To see how the JRE operates, run one of the sample programs as listed in Running a Sample Java Program.
You can invoke the JRE either with or without a peer (an intermediate process or companion helper application that can start local clients on the Netstation). The default is for the JRE to run without a peer. You may wish to change this default if:
$NsRoot
directory structure.
/opt/hpxt/enware2
directory structure.
If you invoke the JRE with a peer:
If you invoke the JRE without a peer (this is the default):
/opt/hpxt/enware2
directory structure.
The JRE will not be able to access the user's home directory or
applications and class files that are installed in other directories.
nobody
).
HP Netstation Software includes various sample Java programs. These programs are installed in
/opt/hpxt/enware2/Java_1.1.2
/demo
. To run one of these programs, follow these steps:
/opt/hpxt/enware2/Java_1.1.2/hostbin
hpxt.java
/opt/hpxt/enware2/Java_1.1.2/demo/TicTacToe/example1.html
To start a Java program (application or applet) from the command line, do the following:
/opt/hpxt/enware2/Java_1.1.2
/hostbin
to the PATH environment variable.
hpxt.java [java_args] [classname [class_args] ] hpxt.appletviewer [applet_args] filename [appletviewer_args] hpxt.java_peer [java_args] [classname [class_args] ] hpxt.appletviewer_peer [applet_args] filename [appletviewer_args]
where:
hpxt.java
hpxt.appletviewer
_peer
scriptsFor information about the other invocation options, access the following man pages:
man hpxt.java
man hpxt.appletviewer
.
The JRE searches for class files in the following directories:
/opt/hpxt/enware2/Java_1.1.2/lib/classes.zip /opt/hpxt/enware2/Java_1.1.2/lib/classes /opt/hpxt/enware2/Java_1.1.2/user_java/lib/classes.zip /opt/hpxt/enware2/Java_1.1.2/user_java/lib/classes
To override this default, and not use the default class path at all,
use the -nodefault
option.
-classpath
option.
-classpath
option,
it searches the directories specified in
the CLASSPATH environment variable.
From any of the supported local window managers, you can start a Java program (application or applet) as follows:
Java
to load an application
You can also customize your local window manager to add these choices to the control panel menus. For example, to add these menu choices to your CDE Lite menus, follow the instructions in the following man pages:
man hpxt.dtwmlite
man hpxt.dtfpfile
man hpxt.dtdtfile
If you invoke hpxt.java
(or hpxt.java_peer
) without specifying a class name,
the console window appears.
Java Console
To start an application, select the File menu, then Start Java Application. If you are not sure of the name of the application, select the File menu and then Browse to search for application names.
To change the default behavior of the console, refer to:
When you start a Java application or applet,
the Java console normally runs in the background.
It appears when it is needed
(when the application attempts to read from
stdin
or write to stdout
or stderr
).
You can override this default using the following options:
-showconsole
to always show the console
-noconsole
to never show the console
If you want to make the console disappear, select File then Hide Console. To bring the console screen back, see Re-displaying the Console Screen.
[F12]
.
In most window managers, you can also select the small horizontal bar icon in the upper left corner of the Java window and then select Show Java Console.
You can develop your own applications or acquire them from third parties. In either case, you make the application available to your users as follows:
/opt/hpxt/enware2/user_java/lib
/opt/hpxt/enware2/user_java/
appname
You would usually install large applications with complicated class hierarchies in their own directories.
/opt/hpxt/enware2/Java_1.1.2/bin/user_java.directives
For more information about the syntax used in this file, see
the /opt/hpxt/enware2/xthome
/bin/directives
file.
If you want to print from within a Java application, you need to ensure that you have configured the printer to work with your Netstation. For details, refer to Using LPR and LPD to Set Up Printing.
This section is intended for programmers who develop Java applications to run on HP Netstations. The key features of this Java Runtime Environment are:
stdin
or writes to stdout
or stderr
,
the Java console is used.
For information about the Netstation-specific classes, open the following file from a web browser:
/opt/hpxt/enware2/Java_1.1.2/doc/html/NETSTATIONProcess.html
For information about other classes, open the following location from a web browser:
http://java.sun.com/products/jdk/1.1/docs/api/packages.html
java/lang/Thread
If the Java Virtual Machine (JVM) does not load, you will be unable to run any Java programs. If this is the case, the most likely cause is that the shared library path is not set properly. Check the Terminal Log in the configuration screens (Choose Diagnostic then Log).
hpxt.java [classname] -v
Java program
-v
indicates verbose mode, and
You can change the Classpath setting in the following ways:
-classpath
directories
dtprofile
in your
$HOME directory. If you are using HP VUE, this file is .profile
in the
$HOME directory.)
java/lang/Thread
If you receive a message indicating that the Java Runtime Environment cannot
find class java/lang/Thread
, the problem is most likely that you are running
the Java Runtime Environment with a peer, and that the peer is running on
a host that does not have the HP Netstation Software Java files installed.
To resolve this problem, you can:
Security violation errors may occur if:
$NsRoot
directory.
If you decide that you want to override the security violation errors, you can reset the permissions in:
/opt/hpxt/enware2/Java_1.1.2/lib/appletviewer.properties