Hi Xavier,
You may want to look at this:
http://aspn.activestate.com/ASPN/Mail/Message/Jython-users/1178516
I tested your example on Windows XP using jreload:
<snip>
# foo.py
import sys
import os
import jreload
jreload.makeLoadSet('jar', [os.path.join(os.getcwd(),'trial.jar')])
import jar
print jar.pck.Foo.foo()
</snip>
I gives:
<snip>
C:/>jython foo.py
Foo!
</snip>
Thanks,
Andre
http://www.burgaud.com/
-----Original Message-----
From: Xavier Noria [mailto:fxn@...]
Sent: Sunday, February 27, 2005 5:38 AM
To: 'jython-users@...'
Subject: Re: [Jython-users] Re: problem with jars in Windows XP (Xavier
Noria)
On Feb 27, 2005, at 11:27, Armin Ehrenfels wrote:
> Xavier,
>
> Sunday afternoon and low temperatures outside, a good opportunity to
> write a few emails.
Hi! It's relatively cold down here in Barcelona as well, though I bet
warmer than there :-),
> sorry for having been so terse and even made a mistake with my
> environment on Windows XP. No, what I suggested doesn't work on my
> system, either. Of course, you are right, this behaviour is not
> correct. But, I'm with Todd who mentioned setting CLASSPATH
> appropriately. This is a secure way to have all Java classes
> available.
Well, it is a secure way in the sense that the other one is buggy,
sys.path.append is as robust as setting a CLASSPATH from a formal point
of view. In that sense I'd call using CLASSPATH instead of
sys.path.append a _workaround_.
Think that you don't always know the CLASSPATH in advance and my be
interested in constructing one on the fly. For instance if you were
writing a servlet container, or an IDE as is my case. Then the
workaround is a custom class loader but the point is that with
sys.append it shouldn't be needed (speaking broadly). You are able to
modifiy the classpath _easily_ in Jython in runtime, another thing that
is a PITA to do in Java turned into a single method call in Jython.
That's great.
I saw in Jython Essentials something like sys.path.append(jar) it was
being defined at the time of writing (I don't have the book here to
quote), so maybe we are using a not-yet clearly defined feature and
thus calling that "buggy" is not accurate.
-- fxn
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users
|