Why does the first call to JAVAADDPATH and IMPORT not work from within a function?

3 views (last 30 days)
when I run my function that calls javaaddpath and import for the first time I receiver the following error:
??? Error: File: importtest.m Line: 5 Column: 8
Arguments to IMPORT must either end with ".*"
or else specify a fully qualified class name: "package.class" fails this test.
The second call doesn't fail.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 25 Oct 2010
This enhancement has been incorporated in Release 2010b (R2010b). For previous product releases, read below for any possible workarounds:
This behavior is not a bug and is due to a change in import in MATLAB 7.0 (R14).
To work around this issue run the javaaddpath and the import command in script before running the function. If you would like to compile your code. Run JAVAADDPATH and IMPORT in the startup.m file. To know more about startup, run
doc startup
in MATLAB.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!