octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: javaclasspath


From: Philip Nienhuis
Subject: Re: javaclasspath
Date: Fri, 21 Dec 2012 15:55:44 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 SeaMonkey/2.0.6

Rik wrote:
On 12/20/2012 11:58 AM, Philip Nienhuis wrote:
Rik wrote:
On 12/15/2012 02:30 PM, address@hidden wrote:
Message: 7
Date: Sat, 15 Dec 2012 14:30:28 -0800 (PST)
From: Philip Nienhuis<address@hidden>
To: address@hidden
Subject: Re: Opportunities for core work on Java
Message-ID:<address@hidden>
Content-Type: text/plain; charset=us-ascii

Rik-4 wrote

<snip>

Do you have access to Matlab to try some experiments?  It seems that the
current working directory may be included by default in the dynamic path.
But, given that the paths in the classpath are absolute I think this must
mean the startup directory from which Matlab was launched.  Could you open
a brand new instance of Matlab and run 'javaclasspath' and report the
output.

Also, the documentation seems to imply that every time the dynamic path is
modified ALL java objects are cleared.  Can you test that?

Sample Code:
clear all
x = javaObject ('java.lang.StringBuffer', 'Hello World')
whos
javaaddpath ('/tmp')
whos

r2012a:

clear all
x = javaObject ('java.lang.StringBuffer', 'Hello World')

x =

Hello World

whos
   Name      Size            Bytes  Class                     Attributes

   x         1x1                    java.lang.StringBuffer

javaaddpath ('c:\temp')
whos
   Name      Size            Bytes  Class                     Attributes

   x         1x1                    java.lang.StringBuffer



so javaadpath leaves Java objects untouched.
Which IMO is entirely reasonable. I really can't see why adding something
to a PATH would clear objects.
Straight quote from the documentation,

"The functions javaaddpath and javaclasspath(dpath) add entries to the
dynamic class path. To avoid the possibility that the new path contains a
class or package with the same name as an existing class or package, MATLAB
clears all existing global variables and variables in the workspace."

And from javaaddpath,
"MATLAB calls the clear java command whenever you change the dynamic path."

So, it's possible that they don't mean what they say.  Or maybe the example
I gave was somehow too simple.  I guess we won't bother with compatibility
in this case.

Matlab has the "import" command to import certain Java classes (from Java class libs in the javaclasspath). I never understood in detail how it works. But it may be that it is those imported classes that get reset.

BTW (now that I see it) will a "clear java" command be implemented in Octave? (I mean is it needed?)

Philip


reply via email to

[Prev in Thread] Current Thread [Next in Thread]