Arbortext Command Language > set Command Options > set javaclasspath
  
set javaclasspath
set javaclasspath=dir1 [:dirn]
This command specifies the list of directories that the Arbortext Editor embedded Java Virtual Machine (JVM) should search to locate Java classes when Java methods are called from within Arbortext Editor. The initial path setting of set javaclasspath is empty.
Whether javaclasspath is set or not, Arbortext Editor automatically includes the distributed Java JAR files in the directory Arbortext-path\lib\classes.
* 
If there are classes in the Arbortext-path\custom\classes subdirectory at startup, the \custom\classes path is automatically prepended to the class path. If there are any subdirectories of the \classes directory that contain classes, those subdirectories are also prepended to the path.
The setting for javaclasspath is only evaluated when the first java_type function is called in an Arbortext Editor session. Subsequent changes to set javaclasspath will not affect the running Java Virtual Machine unless you exit Arbortext Editor and start a new session. Consequently, when using the java_type functions, you should set javaclasspath before invoking a java_type function.
Examples:
set javaclasspath="c:\\winnt\\java\\classes;c:\\myjava\\myjava.jar"
Multiple directories are delimited with semicolons and the entire set enclosed in quotes.
If there is an Arbortext-path\custom\classes subdirectory at startup containing any JAR files (.jar), the path for each .jar file is automatically prepended to the Java class path for Arbortext Editor. Then the \custom\classes path is prepended, which automatically includes any compiled Java .class files in it. Putting your .class and .jar files in the \custom\classes subdirectory makes them automatically available, avoiding manual steps to add them to the path.
You should use the append_javaclass_path function to update the Java class path for Arbortext Editor to avoid problems resulting from overlooking a Java class path when using set javaclasspath.
If set javaclasspath is used with Arbortext Publishing Engine, you should protect it from being sourced again after the JVM has started. Put the set javaclasspath statement inside an appropriate if statement. For example:
# Try to change this value only if the JVM has not started yet.
# This protects from failure in case this file is sourced again
# after the JVM has already started.
if (!java_init()) {
set javaclasspath="c:\\winnt\\java\\classes;D:\\myjava\\myjava.jar"
}
Related Topics
option_path_list function
append_javaclass_path function
java_constructor function
java_init function
java_instance function
java_static function
set javadebugport command
set javavmargs command
set javavmmemory command
set javavmpath command