Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
addpath, directory access failure

Subject: addpath, directory access failure

From: Shirley Zheng

Date: 14 Apr, 2011 16:00:24

Message: 1 of 2

Hello, thanks first!

I am trying to add path dynamically to the classpath.txt, buy I got the warning message" directory access failure", and after that I got the error message" no class 'javaapplication1.callEightBit_Histogram' can be located on java class path", what could be my problems? My code is as following:

function myFunction()
...
addpath(genpath('C:/Documents/MATLAB/Level/lib/ij.jar'));
addpath(genpath('C:/Documents/MATLAB/Level/JavaApplication1.jar'));
    
path

    clear javaapplication1.*;
    clear java;
    import javaapplication1.*;
    
    J = javaObject('javaapplication1.callEightBit_Histogram');

When the classpath is displayed, the path is actually not added. What could be my problem?

Thanks,

Shirley

Subject: addpath, directory access failure

From: Yair Altman

Date: 14 Apr, 2011 22:06:05

Message: 2 of 2

"Shirley Zheng" wrote in message <io75mo$ngp$1@fred.mathworks.com>...
> Hello, thanks first!
>
> I am trying to add path dynamically to the classpath.txt, buy I got the warning message" directory access failure", and after that I got the error message" no class 'javaapplication1.callEightBit_Histogram' can be located on java class path", what could be my problems? My code is as following:
>
> function myFunction()
> ...
> addpath(genpath('C:/Documents/MATLAB/Level/lib/ij.jar'));
> addpath(genpath('C:/Documents/MATLAB/Level/JavaApplication1.jar'));
>
> path
>
> clear javaapplication1.*;
> clear java;
> import javaapplication1.*;
>
> J = javaObject('javaapplication1.callEightBit_Histogram');
>
> When the classpath is displayed, the path is actually not added. What could be my problem?
>
> Thanks,
>
> Shirley


Shirley, I think that you may be mixing up between the dynamic and static classpaths:

  - The dynamic classpath can be modified in run-time, using the built-in javaaddpath() function

  - The static classpath is only loaded once, when Matlab starts, and so any changes done to it will not affect the current Matlab session. You need to restart Matlab to see the effects. The static classpath is what you see in the classpath.txt file. This file may be accessible only to an administrator. If this is the case for you, then you can simply save a copy of this file in your personal Matlab start-up folder and modify the file there. Again - after modifying the file, you need to restart Matlab.

Yair Altman
http://UndocumentedMatlab.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us