hpj Command

This page describes the hpj command and provides a complete description of the command syntax, options, and arguments. The hpj command is similar to the JDK javac command. Specifically, this page discusses the following topics:

Syntax

hpj [[options]...input-files]...

hpj
The command used to compile Java source and bytecode into platform-specific executables and DLLs.
 
options
Options that you can specify with the hpj command to control compilation activities. All command options begin with a dash (-) and must be separated from associated arguments by a space. A table containing a list of valid options is found below in the section entitled Options.
 
input-files
The names of input files that you can specify with the hpj command. The specified files are used to build up a list of classes that will comprise a DLL or executable. A table containing a list of valid input files is found below in the section entitled Input Files.
 
The input-files argument is tested to see if it is the name of a class or an existing file. If it is both, it is diagnosed ambiguous and ignored. If it is a file name, the standard extensions are checked and processed accordingly and any classes in a .zip or .jar file are added. If it is not a class or a file, it is checked to see if it is a package name. If the argument is a package name, all classes in that package and all subpackages are added. If it is not a package name, but it ends with the extensions .obj, .o, .lib, or .a, it is saved to be passed to the linker.

Options
The following table lists the options and associated arguments that you can specify with the hpj command.

Option Description Default
     
-- arg Treat any argument specified with the double-dash (--) option as a filename, even if the argument begins with a dash (-).  
-architecture arch Generate code for the specified architecture.  

The arch argument may be any one of the following values:

com
Code will run on all the POWER and PowerPC hardware platforms.
pwr
Code will run on the POWER hardware platform.
pwr2
Code will run on the POWER2 hardware platform.
pwrx
Same as pwr2.
ppc
Code will run on any of the 32-bit PowerPC hardware platforms.
ppcgr  
Similar to ppc, but contains optional graphics instructions for PowerPC processors.

The arch argument may be any one of the following values:

x86
Code will run on any 32-bit x86 architecture.
486
Code will run on any architecture supporting the 486 instruction set.
pentium
Code will run on any architecture supporting the Pentium instruction set.
pentium2
Code will run on any architecture supporting the Pentium2 instruction set.
com

486

-B option Pass the specified option to the linker.  The valid options are linker- and operating system-specific.  
-c Compile to an object file without linking.  
-classpath path Set the classpath to the specified path. HPCJ-specific entries are not added to the classpath if this option is used. (The default classpath is the value specified for the environment variable CLASSPATH, with the HPJ classes prepended and '.' appended.) Additional information about setting the classpath is found in the topic Changing Environment Settings.  
-[no]collapse [Do not] Put object files in one directory. The default is the current directory unless the -d option is specified. -nocollapse
-[no]compact [Do not] Reduce code size at the expense of execution speed. -[no]compact
-d dir Deposit class and object files in the specified directory and its subdirectories, rather than in the directory in which the source or class files are found.  
-exclude prefix Exclude all classes beginning with the specified prefix. In this case, prefix can be one of the following:

foo
foo
*
foo\*

If you specify foo as the prefix, the compiler searches for a specific class named foo. If you specify foo* as the prefix, the compiler searches for all classes that begin with the string foo. If you specify foo\* as the prefix, it is the same as specifying foo*.

Additional information about this option is discussed in the section below entitled Understanding the -include and -exclude Options.

 
-exe Produce an executable. This is the default action unless the -c, -jll, or -jlc option is specified. -exe
-[no]follow [Do not] Recursively compile classes referenced from classes specified on the command line. -follow (unless -c is specified)
-[no]g [Do not] Emit debugging information. -nog
-help or -? If no other arguments are specified on the command line, the -help or -? options cause HPCJ to display usage information.  
-include prefix Include all classes beginning with the specified prefix. In this case, prefix can be one of the following:

foo
foo
*
foo\*

If you specify foo as the prefix, the compiler searches for a specific class named foo. If you specify foo* as the prefix, the compiler searches for all classes that begin with the string foo. If you specify foo\* as the prefix, it is the same as specifying foo*.

Additional information about this option is discussed in the section below entitled Understanding the -include and -exclude Options.

 
-jlc Compile each class into a simple DLL with a .jlc extension.  
-jll Compile classes into a compound DLL with a .jll extension.  
-[no]list [Do not] Produce object code listing files. -nolist
-main classname Set the name of the class that contains the main() method. First class found during processing that contains main()
-maxmem size Restrict optimizations to use no more than size kilobytes.  
-nomaxmem Use as much storage as available for optimizations.  
-o file Name the executable file, compound DLL (.jll), or simple DLL (.jll). If the -o option is not specified, then the default name of the executable is:

a.out

The name of the class that contains main()

If the -o option is not specified, then the default name of any simple DLL is the class name. (Note that there is no default name for compound DLLs, so you must use the -o option.)

-[no]O [Do not] Optimize. -noO
-partial prefix Compile only those classes that begin with the specified prefix. In this case, prefix can be one of the following:

foo
foo
*
foo\*

If you specify foo as the prefix, the compiler searches for a specific class named foo. If you specify foo* as the prefix, the compiler searches for all classes that begin with the string foo. If you specify foo\* as the prefix, it is the same as specifying foo*.

Additional information about this option is discussed in the section below entitled Understanding the -include and -exclude Options.

 
-spill size Restrict the spill area to size bytes. The -spill option defines the number of bytes of stack space to reserve in each subprogram, in case there are too many variables to hold in registers and the program needs temporary storage for register contents.  
-tune arch Optimize code generation for a particular architecture.

The arch argument may be any one of the following values:

601
Code will be optimized for all the PowerPC 601 processors.
603
Code will be optimized for all the PowerPC 603 processors.
604
Code will be optimized for all the PowerPC 604 processors.
pwr
Code will be optimized for the POWER hardware platform.
pwr2
Code will be optimized for the POWER2 hardware platform.
pwr2s
Code will be optimized for the POWER2 hardware platform, avoiding certain quadruple-precision instructions that would slow program performance.
pwrx
Same as pwr2.

The arch argument may be any one of the following values:

386
Code will be optimized for the 386 processor.
486
Code will be optimized for the 486 processor.
pentium
Code will be optimized for the Pentium processor.
pentium2
Code will be optimized for the Pentium2 processor.
blend
Code will be optimized for all the X86 processors.
pwr (if the -architecture option is specified)

blend

Understanding the -include and -exclude Options
HPCJ produces an executable or DLL by taking a list of classes specified on the command line and compiling the classes to object code. In turn, the generated object files contain references to other classes. The nature of each reference is dependent on whether the referenced class is contained within the same binary file, either an executable or compound DLL (.jll), or in another binary file. When an executable or compound DLL is compiled, all of the classes within that binary file must be added to a list of classes that can be read by the compiler. There are several hpj command options that play a role in building the list of classes.

When you specify a Java source file, class file, or a classname as an argument on the hpj command, it adds a class to the list of classes that are accumulated for the specified binary file. Similarly, when a .zip or .jar file is specified, all of the classes contained within the file are added to the list. The -include option and accompanying prefix argument is used to add all of the specified classes found in the classpath to the list of classes. Unless the -nofollow option is specified, once all of the command line options have been processed, a dependancy analysis is performed, which means that any new classes that are found by recursively following references from classes in the list of classes are added to the class list. When a class list has been built using the -include option, any classes identified using the -exclude option and accompany prefix argument are processed in order from left to right and removed from the class list. A final list of classes is then produced that is used to build the executable or compound DLL. Any known JDK classes that are already supplied by the HPCJ compound DLLs (java and sun packages, excluding sun.tools) are ignored. At this point, HPCJ begins to compile the object code.

It is recommended that you compile and link in one step. Because the hpj command needs a complete list of classes within the compound DLL or executable being compiled, it is possible to produce incompatible objects in different invocations of HPCJ. You can then produce a compound DLL or executable that appears to link without any errors, but that actually consists of incompatible object files.

Input Files
The following table lists the input files that you can specify using the hpj command.

Input Files Description
   
file.java The name of a Java source file that is added to the list of source files. When the compiler is run against this file, all classes generated from the source file are added to the list of classes. The class and object files compiled from the source files are placed into the same directory as the source files.
classname The name of a Java class file (specified without a .class extension) that is added to the list of classes. The class must appear in the classpath. Class files are compiled to object files. The default behavior is to compile the object files into the same directory as the class files.
file.class The name of a Java class file (specified with a .class extension) that is added to the list of classes. The class must appear in the classpath. Class files are compiled to object files. The default behavior is to compile the object files into the same directory as the class files.
file.jar
file.zip
The name of a JAR or ZIP file that contains classes that are added to the list of classes. Specifing a JAR or ZIP file is equivalent to specifying all of the classes contained within the JAR or ZIP file. Classes contained in JAR or ZIP files are compiled to the current directory in much the same way that classes are compiled to the current directory if the -collapse option is specified.

file
.o


file
.obj 

The name of an object file that is added to the list of linker files. Object files are simply passed to the linker.

file
.a


file.lib

The name of an object library that is added to the list of linker files. Library files are simply passed to the linker.
@file The name of a response file. Response files are simple text files that contain multiple command-line arguments. The argument @file is replaced on the command line by the contents of the specified file. Any wildcards within a response file are not expanded.

 


Java Executables and DLLs


Building Executables and DLLs
Changing Environment Settings