Got Questions? Get Answers.
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:
Java classpath.txt

Subject: Java classpath.txt

From: Chuck37

Date: 28 Mar, 2012 23:53:31

Message: 1 of 6

I'd like to add some java classes to the static path, but classpath.txt is not a file that I have permissions to edit in my system. I made a classpath.txt in my local area, but I see that the procedure is that matlab attempts to use mine instead of the other one and misses all the standard classes. Is there a way to have user defined additional classes only? Or is classpath.txt essentially totally fixed such that I am fine to simply copy the existing one over to my area and then append to it? Thanks.

Subject: Java classpath.txt

From: Malcolm Lidierth

Date: 29 Mar, 2012 01:07:24

Message: 2 of 6

I have a local install only so can not address the main Q, but unless you need to replace/delete items - e.g. when MATLAB distributed jars are out-of-date, there seems little to gain from editing the static path rather than using javaaddpath to place jars on the dynamic path - particularly if you add the extra jars at the start of a MATLAB session.

Subject: Java classpath.txt

From: Chuck37

Date: 29 Mar, 2012 01:51:23

Message: 3 of 6

"Malcolm Lidierth" wrote in message <jl0ckc$cpp$1@newscl01ah.mathworks.com>...
> I have a local install only so can not address the main Q, but unless you need to replace/delete items - e.g. when MATLAB distributed jars are out-of-date, there seems little to gain from editing the static path rather than using javaaddpath to place jars on the dynamic path - particularly if you add the extra jars at the start of a MATLAB session.

Some things I read suggest that it will load faster from the static path. I honestly don't understand it, but if it is easy I was going to give it a shot.

Subject: Java classpath.txt

From: Malcolm Lidierth

Date: 29 Mar, 2012 02:44:31

Message: 4 of 6

"Chuck37" wrote in message <jl0f6r$k7m$1@newscl01ah.mathworks.com>...
> "Malcolm Lidierth" wrote in message <jl0ckc$cpp$1@newscl01ah.mathworks.com>...
> > I have a local install only so can not address the main Q, but unless you need to replace/delete items - e.g. when MATLAB distributed jars are out-of-date, there seems little to gain from editing the static path rather than using javaaddpath to place jars on the dynamic path - particularly if you add the extra jars at the start of a MATLAB session.
>
> Some things I read suggest that it will load faster from the static path. I honestly don't understand it, but if it is easy I was going to give it a shot.

True - but loading a class is a one-off event. The only time I see a (just) noticeable delay is when I first reference a class in a jar - even when it has quite a number of dependent jars in its /lib folder.

Subject: Java classpath.txt

From: Yair Altman

Date: 30 Mar, 2012 00:34:35

Message: 5 of 6

"Chuck37" wrote in message <jl089q$15d$1@newscl01ah.mathworks.com>...
> I'd like to add some java classes to the static path, but classpath.txt is not a file that I have permissions to edit in my system. I made a classpath.txt in my local area, but I see that the procedure is that matlab attempts to use mine instead of the other one and misses all the standard classes. Is there a way to have user defined additional classes only? Or is classpath.txt essentially totally fixed such that I am fine to simply copy the existing one over to my area and then append to it? Thanks.


Unfortunately, the classpath.txt file is not additive. This means that you need to copy everything from Matlab's default classpath file to your local copy. This is actually quite simple to do.

The down side is that if you ever try to start any other Matlab release in your local folder, chances are that Matlab will not start, or ("best case" scenario) will start but have numerous problems. This is because the JARs in your local copy will probably not correlate with what the other Matlab release expects. So, you would need to maintain different copies of your local classpath.txt file, and switch between then whenever you wish to use a different Matlab release. Admittedly, this is a royal pain in the so-and-so...

Yair Altman
http://UndocumentedMatlab.com
Read my Matlab-Java Programming book
 

Subject: Java classpath.txt

From: ImageAnalyst

Date: 29 Mar, 2012 02:10:51

Message: 6 of 6

On Mar 28, 9:51 pm, "Chuck37 " <chuck3...@yahooremovethis.com> wrote:
> "Malcolm Lidierth" wrote in message <jl0ckc$cp...@newscl01ah.mathworks.com>...
> > I have a local install only so can not address the main Q, but unless you need to replace/delete items - e.g. when MATLAB distributed jars are out-of-date, there seems little to gain from editing the static path rather than using javaaddpath to place jars on the dynamic path - particularly if you add the extra jars at the start of a MATLAB session.
>
> Some things I read suggest that it will load faster from the static path.  I honestly don't understand it, but if it is easy I was going to give it a shot.

---------------------------------------------------------------------
I find that hard to believe - that it has any significant difference
in speed. I modified my path in C:/Program Files/MATLAB/R2011a/
toolbox/local/classpath.txt. Why? Because if you call
javaclasspath() in your code, if you have any global variables, they
get instantly blown away. That doesn't happen if you set the path in
advance. But if you aren't allowed to edit that file, then you're
stuck using javaclasspath, which shouldn't be a problem if you're not
using global variables (I don't think anyway).

Tags for this Thread

No tags are associated with 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