javaclasspath - Return Java class path or specify dynamic path - MATLAB (original) (raw)

Return Java class path or specify dynamic path

Syntax

Description

javaclasspath displays the static and dynamic segments of the Java® class path.

javaclasspath('-dynamic') displays the dynamic path.

javaclasspath('-static') displays the static path.

[dpath](#btmhknu-1-dpath) = javaclasspath returns the dynamic path, dpath.

example

[spath](#btmhknu-1-spath) = javaclasspath('-static') returns the static path, spath.

[jpath](#btmhknu-1-jpath) = javaclasspath('-all') returns the entire path, jpath. The returned cell array contains first the static segment of the path, and then the dynamic segment.

javaclasspath([dpath](#btmhknu-1-dpath)) changes the dynamic path to dpath. Use this syntax to reload Java classes that you are actively developing and debugging.

javaclasspath([dpath1,dpath2](#btmhknu-1-dpath1dpath2)) changes the dynamic path to the concatenation of paths dpath1,dpath2.

javaclasspath([statusmsg](#btmhknu-1-statusmsg)) enables or disables the display of status messages.

Examples

collapse all

Create a cell array, p, with the entries of the dynamic path. If there are no entries on the dynamic path, then MATLAB® creates an empty cell array.

javaclasspath('-v0') % Suppress display of class-loading messages p = javaclasspath

Input Arguments

collapse all

Path entries, specified as a string, an array of strings, a character vector, or a cell array of character vectors for the dynamic path. MATLAB converts relative paths to absolute paths.

Example: javaclasspath('https://www.example.com')

Data Types: char | cell

Path entries, specified as a string, an array of strings, a character vector, or a cell array of character vectors concatenated for the dynamic path.

Data Types: char | cell

Message flag, specified as one of these values.

'-v0' Do not display status messages when loading the Java path from the file system.
'-v1' Display status messages.

The statusmsg argument controls status message display from the javaclasspath, javaaddpath, and javarmpath functions.

Output Arguments

collapse all

Dynamic path entries for the current path, returned as an array of strings or a cell array of character vectors. If there are no path entries, then dpath is an empty cell array.

Static path entries for the current path, returned as an array of strings or a cell array of character vectors. If there are no path entries, then spath is an empty cell array.

All path entries, returned as an array of strings or a cell array of character vectors. If there are no path entries, then jpath is an empty cell array.

More About

collapse all

The static path is a segment of the Java path that 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. To modify the static Java path, edit the file javaclasspath.txt and restart MATLAB. For more information, see Static Path of Java Class Path.

The dynamic path is a segment of the Java class path.

MATLAB provides the dynamic path as a convenience for when you develop your own Java classes. You can load the dynamic path any time during a MATLAB session using the javaclasspath function. 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. After you develop and debug a Java class, add the class to the static path.

For more information, see Dynamic Path of Java Class Path.

Tips

Version History

Introduced before R2006a