Re: [Objectscript-users] using mountJarFile
Brought to you by:
rob_d_clark
|
From: Rob C. <ro...@ti...> - 2005-10-07 15:04:47
|
A couple things...
first, mounting it just makes it available within the abstract
filesystem. So you could then, for example, use pkg.fs.File() to
access files within the jar (ie "/jar/xstream-SNAPSHOT/foo/bar.os").
And of course if you have script files within the jar, they could be
imported or accessed thru pkg. But it does not add the jar to the
classpath. (Although I think this could be implemented, and it is an
interesting idea... I'll have to look into it.)
second, you will probably need to use pkg.system.declareJavaPackage()
for any java package that is first accessed from the script
environment, otherwise the JavaPackage object has no way to know that
the package actually exists, and so it will throw a
NoSuchMemberException.
On Oct 6, 2005, at 6:10 PM, Lysander David wrote:
> Hi,
>
> How does one use pkg.system.mountJarFile ?
>
> I am attempting to instantiate an object of
> class com.thoughtworks.xstream.XStream.
> The class exists in this jar:
>
> xstream-SNAPSHOT.jar
>
> When I execute these commands:
>
> import "reflection.os";
> var file = new pkg.fs.File ( "xstream-SNAPSHOT.jar" );
> pkg.system.mountJarFile ( file );
> var com = new JavaPackage ("com" );
> var x = new com.thoughtworks.xstream.XStream();
>
>
> I get this error:
>
> oscript.exceptions.PackagedScriptObjectException:
> NoSuchMemberException: no such member: JavaPackage:
> thoughtworks
>
>
> What must be done to mount xstream-SNAPSHOT.jar
> and instantiate com.thoughtworks.xstream.XStream ?
>
> Thanks
>
-- Rob
____________________
CONTACT INFORMATION:
email: ro...@ti...
IM: rob@sandjabber
|