External Interfaces Reference Previous page   Next Page
javarmpath

Remove entries from dynamic Java class path

Syntax

Description

javarmpath('dpath') removes a directory or file from the current dynamic Java path. dpath is a string containing the directory or file specification. (See the Remarks section, below, for a description of static and dynamic Java paths.)

javarmpath dpath1 dpath2 ... dpathN removes those directories and files specified by dpath1, dpath2, ..., dpathN from the dynamic Java path. Each input argument is a string containing a directory or file specification.

javarmpath(v1, v2, ..., vN) removes those directories and files specified by v1, v2, ..., vN from the dynamic Java path. Each input argument is a variable to which a directory or file specification is assigned.

Remarks

The Java path consists of two segments: a static path and a dynamic path. MATLAB always searches the static path before the dynamic path. Java classes on the static path should not have dependencies on classes on the dynamic path.

Path Type
Description
Static
Loaded at the start of each MATLAB session from the file classpath.txt. The static Java path offers better Java class loading performance than the dynamic Java path. However, to modify the static Java path you need to edit the file classpath.txt and restart MATLAB.
Dynamic
Loaded at any time during a MATLAB session using the javaclasspath function. You can define the dynamic path (using javaclasspath), modify the path (using javaaddpath and javarmpath), and refresh the Java class definitions for all classes on the dynamic path (using clear java) without restarting MATLAB.

Examples

Create a function to set your initial dynamic Java class path:

Call this function to set up your dynamic class path. Then, use the javaclasspath function with no arguments to display all current static and dynamic paths:

At some later time, add the following two entries to the dynamic path. One entry specifies a directory and the other a Java Archive (JAR) file. When you add a directory to the path, MATLAB includes all files in that directory as part of the path:

Use javaclasspath with just an output argument to return the dynamic path alone:

Create an instance of the mywidgets class that is defined on the dynamic path:

If, at some time, you modify one or more classes that are defined on the dynamic path, you will need to clear the former definition for those classes from MATLAB memory. You can clear all dynamic Java class definitions from memory using,

If you then create a new instance of one of these classes, MATLAB uses the latest definition of the class to create the object.

Use javarmpath to remove a file or directory from the current dynamic class path:

See Also

javaclasspath, javaaddpath, clear


Previous page  javaObject usejava Next page

© 1994-2005 The MathWorks, Inc.