Java Options and Debugging
This section describes how to control the procedure used by Creo applications to invoke synchronous Creo Object TOOLKIT Java applications to enable you to use a non-default JVM or to debug your applications.
Supported Java Virtual Machine Versions
The machine information for the JVM versions supported by Creo Object TOOLKIT Java is available at http://support.ptc.com/partners/hardware/current/support.htm.
The Creo installation includes a default JVM shipped as a part of its CD image. For synchronous Creo Object TOOLKIT Java applications, Creo uses the shipped JVM by default.
Creo application includes the ability to override the default JVM command used to invoke Creo Object TOOLKIT Java applications. This allows you to:
•  Use a non-standard JVM in your deployment, if that JVM has a feature or a fix that is necessary for your application to work correctly.
•  Apply command line flags to the Java invocation, thus allowing it to be used for debugging or other customized purposes.
Synchronous Creo Object TOOLKIT Java
The JVM that is used can be overridden using one of the following mechanisms:
•  The configuration option jlink_java_command, if set to the path to the java executable, will determine the JVM be used to start synchronous Creo Object TOOLKIT Java applications.
•  The environment variable PRO_JAVA_COMMAND serves the same purpose as the configuration option. The environment variable takes precedence over the configuration option.
Note
The appropriate flags for synchronous Creo Object TOOLKIT Java as well as the flags for the user-supplied JRE must be used. The synchronous Creo Object TOOLKIT Java flags are listed on the Creo Object TOOLKIT Java platform page. It is recommended that you update the version of the JVM on your machine to the minimum supported version for the platform.
Debugging a Synchronous Mode Application
As Creo application has control over the start and stop of Java processes used by Creo Object TOOLKIT Java, you must use special controls to be able to debug an application. The most typical deployment should do the following:
1. Use the appropriate javac compiler flags to build the application debuggable.
2. Use the technique described in the section Synchronous Creo Object TOOLKIT Java to set the Java command to the appropriate debug command line, for example, [JDK_HOME]/bin/java.exe -Xdebug
3. Start the Creo application and let it invoke the Java application.
4. Attach your Java debugger to the process that was started by the Creo application.
If you need to debug within the application start method, you can make the first invocation within that method a UI popup dialog box (javax.swing.JOptionPane) which will allow time to attach the debugger to the process.
CLASSPATH Variables
Synchronous Mode
If you are using the default JVM and are running Creo Object TOOLKIT Java applications on your machine, you need to add only your application classes to the classpath. The mechanisms to accomplish this are:
•  Setting the environment variable CLASSPATH.
•  Using the java_app_classpath field in the registry file. This field has a character limit of 2047 wide characters (wchar_t).
•  Loading a user-specified Jar file through the user interface (only available for a model program).
Creo application will automatically add the Creo Object TOOLKIT Java archive otk.jar to the CLASSPATH.
To compile Creo Object TOOLKIT Java applications, the environment variable CLASSPATH must include the path to the locations of classes and archives that you intend to use. Also, you must add Creo Object TOOLKIT Java archive otk.jar to the CLASSPATH. This archive is located at <creo_loadpoint>\<version>\Common Files\text\java\otk.jar.