Documentation

JavaClass Path

To make Java®classes available to MATLAB®, place them on theJava 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.

内置Java类packages-classes在Javatandard libraries—are already on the class path. You do not need to modify the path to access these classes.

To access Java classes from MATLAB, add them to the class path. For information and examples, seeStatic Path.

  • JAR File Classes

  • Packages

  • Individual (unpackaged) classes

MATLAB segments the Java class path into astatic pathand adynamic path. MATLAB searches the static path before the dynamic path.

  • Use the static path as the default path to load a Java class.

  • Use the dynamic path when developing your own Java classes. You can modify and load the dynamic path any time during a MATLAB session.

Java Class Path Options Action

Display class path

Call thejavaclasspathfunction.

Add files to static path

Create an ASCII text file namedjavaclasspath.txtin your preferences folder. For information and examples, seeStatic Path.

Add or remove files on dynamic path

Call thejavaclasspath,javaaddpath, orjavarmpathfunctions. These functions clear all existing variables and global variables in the workspace. For more information, seeDynamic Path.

Augment search path fornative methodlibraries.

Create an ASCII text file namedjavalibrarypath.txtin your preferences folder. For information, seeLocate Native Method Libraries.

See Also

Related Examples

More About

Was this topic helpful?