System Setup for Java Classes

If you access only the classes that come defined with PeopleTools, you don't need to do any additional setup.

If you want to access third-party Java classes or your own custom Java classes in the PeopleTools environment (that is, access these classes through PeopleCode), you must place the class files in specified locations or include the class files in JAR files in specified locations.

Note: Oracle recommends using the utility that comes with the Java SDK for creating JAR files.

When PeopleTools loads the Java Virtual Machine (JVM), PeopleTools builds a class path for the JVM from the following elements. The following numbering indicates the search order that the JVM would use for locating a specified Java class:

  1. Class files in the PS_HOME\class directory.

  2. Class files in JAR files in the PS_HOME\class directory.

  3. Class files in the PS_HOME\appserv\classes directory.

  4. Class files in JAR files in the PS_HOME\appserv\classes directory.

  5. For each directory listed in the “Add To CLASSPATH” parameter of the psappsrv.cfg configuration file:

    1. Class files in the specified directory.

    2. Class files in JAR files in the specified directory.

  6. For each directory listed in the PS_CLASSPATH environment variable:

    1. Class files in the specified directory.

    2. Class files in JAR files in the specified directory.

    Note: For Application Engine programs, modify the “Add To CLASSPATH” parameter on the Process Scheduler machine.

For example, if PS_CLASSPATH is “dir1;dir2”, the search order for item 6 described previously would be:

  1. Class files in dir1.

  2. Class files in JAR files in dir1.

  3. Class files in dir2.

  4. Class files in JAR files in dir2.

Note: PeopleTools uses the -classpath option when it loads the JVM, which overrides the CLASSPATH environment variable. Therefore, do not use the CLASSPATH environment variable to identify third-party or custom Java classes that you want to access in the PeopleTools environment.

Note: PeopleTools does not guarantee the order in which JAR files within a directory will be added to the class path. If it is necessary to impose a search order on JAR files, then the JAR files must be in separate directories.

Like most environment variables, you can specify more than one entry in PS_CLASSPATH. On Windows, the PS_CLASSPATH entries are separated by semicolons. On Unix, they’re separated by colons.

The following PS_CLASSPATH is for Windows:

c:\myjava;d:\myjava\com\mycompany\myproduct; . . .

The following PS_CLASSPATH would be for Unix:

/etc/myjava:/home/me/myjava/com/mycompany/myproduct: . . .

When developing your own classes you must be aware that most JVMs cache the class definitions. This means that even if you update the class files, a running JVM (inside an application server, for example) has already loaded and is referencing the old versions of the class files. The JVM won’t pick up the new versions of the class files. You must restart the application server to make the JVM reload the updated classes.

See your system documentation for more information about setting an environment variable.