NonStop Server for Java 7.0 Programmer's Reference
This command must display the fully qualified name of the java executable found in your
path. If no Java executable is found, the command displays the message, java not found.
4. Compile the Java source code by using the javac tool.
a. Ensure you have performed step 3 so that javac is in your current path.
b. At the OSS prompt, change the directory (cd command) to where your Java source file
is stored.
c. Compile the Java source code by using the Java compiler, javac, which is part of the
installed NSJ7 product. Type the following command on OSS prompt :
$javac HelloWorld.java
If compilation is successful, the compiler produces a Java class file called
HelloWorld.class. Once you have the class file, your program is ready to run.
d. Check to see that the HelloWorld.class file has been created by typing:
$ls -l HelloWorld.class
If the file is not present or if you received an error message, check for typographical
errors in your source code. Fix the errors, and perform the steps c and d until class file
is created.
5. Run the program by using the Java tool.
a. Go to the directory where your class file is created.
b. To run the HelloWorld program (also called an application), type the following command
at the OSS prompt:
$java HelloWorld
NOTE: You must not type java HelloWorld.class. All Java classes have the
.class extension. Typing .class at the end causes an error message.
Your Java application displays the message, "Hello World!".
Specifying the CPU and process name
You can specify which CPU an application process runs in and its process name by using options
of the run utility. The run utility starts OSS programs with specific attributes.
Use the following command to specify the CPU where a Java application is to run:
run -cpu=cpu_number java class_name
For example, the command to run Java in CPU 3 is:
$run -cpu=3 java HelloWorld
Use the following command to provide a java process a process name:
run -name=/G/process_name java class_name
For example, the command to provide Java the process name $APPJ is:
$run -name=/G/appj java HelloWorld
where,
the /G directory identifies the Guardian fileset.
For information about the /G directory, see Open System Services User's Guide.
The following example combines more than one run option in a single command:
$run -name=/G/japp -cpu=3 java HelloWorld
Specifying the CPU and process name 31










