Create a Java archive application

To create and build a Java archive (JAR) application, complete the following steps:
  1. Create the /home/joe/mywork/hello/hello.mak makefile as shown in the following example:
    JAR := helloworld
    TPF_DRIVER := hello
    JAVA_SRC := HelloWorld.java
    JAVA_SRC += com/pkg/MyClass.java
    maketpf_env := drvs
    include maketpf.rules
    This example shows the minimal amount of code that is required to create the makefile for the JAR application. By default, you compile the Java source segments and package their classes to a JAR application without defining a entry point. However, you can define the entry point and change the compile options:
    • To define the entry point of the JAR application as the HelloWorld class, add the following line to the makefile: JAR_ENTRY := HelloWorld.
    • To change the compile options, use the JAVAFLAGS or CLASSPATH flag in your makefile or maketpf.cfg file.
  2. Create two source segments named /home/joe/mywork/hello/HelloWorld.java and /home/joe/mywork/hello/com/pkg/MyClass.java.
  3. Update the user control file and the user load file with a new entry for the new application:
    1. Create a copy of both files in your working directory:
      cp /tpf/z11/local_mod/base/cntl/{usr.cntl,usr.loadfile}
      /home/joe/mywork/base/cntl/
    2. Edit the control file that you copied and add a new entry for the application named hello. Enter the following information on one line:
      hello;JAR;hello/hello.mak;1;ALL;OBJ;TPF_SBALL;NOLOAD;NOSTUB;DEFAULT;
      DEBUG;50;PROGRAM;NOGRP;IBM_DEFT;NOBPAUTH;NORESTRICT;NOMONTC;NOKEY0;
      NOCMB;TIMESLICE;;;;;;;;;;;;;
    3. Edit the load file that you copied and add a new entry for the file named helloworld.jar. Enter the following information on one line:
      hello/lib/helloworld.jar;/sys/tpf_pbfiles/apps/hello/helloworld.jar;
      644;tpfdfltu;tpfdfltg;BINARY;ALL;TPF_SBALL;LOAD;;;;;

    The control file entry is required to build the JAR application. The load file entry is required to load the JAR application.

  4. Enter the maketpf command to build the program. In the following example, assume that the maketpf.cfg file exists in the /home/joe/mywork/build directory.
     cd /home/joe/mywork/build
     maketpf hello