Documentation Center

  • Trials
  • Product Updates

javaaddpath

Add entries to dynamic Java class path

Syntax

Description

example

javaaddpath(dpath) adds one or more folders or Java® Archive (JAR) files to the beginning of the current dynamic class path.

example

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

Examples

expand all

Add Folder to Dynamic Class Path

Display the current dynamic path.

javaclasspath('-dynamic')
		DYNAMIC JAVA PATH

    <empty>

The output reflects your configuration.

Add the current folder.

javaaddpath(pwd)

Display the dynamic path.

p = javaclasspath
p = 
    'c:\work\Java'

The output reflects your current folder.

Append URL to Dynamic Class Path

javaaddpath('http://www.example.com','-end')
p = javaclasspath
p = 
    'c:\work\Java'
    'http://www.example.com'

Input Arguments

expand all

dpath — Folder or JAR filestring | cell array of strings

Folder or JAR file, specified as a string or cell array of strings, 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

Limitations

  • MATLAB does not support JAR files generated by the MATLAB Builder for Java® product.

More About

expand all

Tips

  • MATLAB calls the clear java command whenever you change the dynamic path. This command clears the definitions of all Java classes defined by files on the dynamic class path, removes all global variables and variables from the base workspace, and removes all compiled scripts, functions, and MEX-functions from memory.

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

See Also

| |

Was this topic helpful?