Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Java Class Path

To make Java® classes available to MATLAB®, place them on the Java class path. The class path is a series of file and folder specifications. When loading a Java class, MATLAB searches the files and folders in the order they occur on the class path. The search ends when MATLAB finds a file that contains the class definition.

MATLAB segments the Java class path into a static path and a dynamic path. The static path is loaded at the start of each MATLAB session from the MATLAB built-in Java path and the file javaclasspath.txt. MATLAB searches the static path before the dynamic path. The static Java path offers better Java class-loading performance than the dynamic Java path. If you modify the static path, you must restart MATLAB. For more information, see Static Path.

The dynamic path is a convenience for developing your own Java classes. You can modify and load the dynamic path any time during a MATLAB session using the javaclasspath function. However, after you develop and debug a Java class, add the class to the static path.

Although the dynamic path offers flexibility in changing the path, Java classes on the dynamic path might load more slowly than classes on the static path. Also, classes on the dynamic path might not behave the same way as classes on the static path. If your class does not behave as expected, then use the static path. For more information, see Dynamic Path.

Java Class Path OptionsAction

Display class path

Call the javaclasspath function.

Add files to static path

Create an ASCII text file named javaclasspath.txt file in your preferences folder. For information, see Static Path.

Add or remove files on dynamic path

Call the javaclasspath, javaaddpath, or javarmpath functions. These functions clear all existing variables and global variables in the workspace. For more information, see Dynamic Path.

Augment search path for native method libraries.

Create an ASCII text file named javalibrarypath.txt in your preferences folder. For information, see Locate Native Method Libraries.

See Also

Related Examples

More About

Was this topic helpful?