This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Add entries to dynamic Java class path





javaaddpath(dpath) adds one or more folders or Java® Archive (JAR) files to the beginning of the current dynamic class path. Use the dynamic path when developing and debugging your own Java classes.

The javaaddpath command clears the definitions of all Java classes defined by files on the dynamic class path.


javaaddpath(dpath,'-end') adds files or folders to the end of the path.


collapse all

Display the current dynamic path. The output reflects your configuration.



Add the current folder.


Display the updated dynamic path. The output reflects your current folder.

p = javaclasspath
p = 
p = javaclasspath
p = 

Input Arguments

collapse all

Folder or JAR file, specified as a string, an array of strings, a character vector, or a cell array of character vectors to add to the dynamic path. When you add a folder to the path, MATLAB® includes all files in that folder as part of the path.

Data Types: char | cell


  • MATLAB does not support JAR files generated by the MATLAB Compiler SDK™ product.


  • Use the dynamic path while you develop your own Java classes. After you develop and debug a Java class, add the class to the static path. For more information, see javaclasspath.

  • To add folders to the static path, which MATLAB loads at startup, create a javaclasspath.txt file, as described in Static Path.

  • If javaaddpath displays the message Not clearing Java, the dynamic path is updated, but you might need to type clear java so that MATLAB detects the new Java classes.

Introduced before R2006a