Compiling and Linking Executables or Compound DLLs

When you compile and link an executable or a compound DLL using the hpj command, you minimally generate one object module and either one .exe or one .jll file for all of your input classes. Information about using the hpj command options to control your compilation activities is found in the topic Building Executables and DLLs.

To compile and link an executable or compound DLL:

  1. Specify the hpj command and either the -exe or the -jll option (mandatory).
  2. Specify one or more Class Selection options and associated input file arguments to indicate the classes you want to compile (mandatory).
  3. Specify one or more Performance options to enhance the performance of your compiled code (optional).
  4. Specify the -g option to generate debugging information (optional).
  5. Specify the -list option to generate listing files (optional).
  6. Specify one of the Output options to indicate the output location of the code (optional).

Example 1:

hpj HelloWorld.java -o hello

In this example, a source file is compiled to an executable. The name of the excutable will be "hello".

Example 2:

hpj -exe -o animator.exe -O -follow Animator.java Animator2.java

In this example, the -exe option instructs the compiler to build an executable. (Note that the -exe option is a default and does not actually need to be specified.) The -o option specifies that the executable is to be named animator.exe. The -O option instructs the compiler to build optimized code. The -follow option instructs the compiler to compile the Java source files Animator.java and Animator2.java, and all classes referenced by those classes, continuing recursively until all classes directly referenced within the application are found and compiled. The only exception is that the core Java classes supplied with HPCJ are not compiled. (Note that the -follow option is a default and does not actually need to be specified.) The classes compiled into animator.exe include Animator, Animator2, and Animator3. (The Animator2 class contains a reference to a class named Animator3.)

Example 3:

hpj -jll -o Animator.jll -O -nofollow Animator Animator2

In this example, the -jll option instructs the compiler to build a compound DLL. The -o option specifies that the compound DLL is to be named Animator.jll. The -O option instructs the compiler to build optimized code. The -nofollow option instructs the compiler to ignore referenced classes and only compile the specified classes Animator and Animator2 into Animator.jll.

 


Java Executables and DLLs


Building Executables and DLLs


hpj Command