On Wed, 29 Oct 2003, Mark Taylor wrote:
> > http://star-www.dur.ac.uk/~pdraper/splat/splat.jnlp
> >
> > If you manage to get a spectrum plotted of any kind, then you've managed
> > to download a native library and load it.
>
> nice!
>
> > dire warning from SUN. This is a hack at present (I needed to modify
> > various parts of NDX and HDX, plus there's no sense of packaging and
>
> just for interest, can you say briefly what kind of changes you needed
> to make to [HN]DX?
Hi Mark,
webstart uses a slightly different class loader strategy to normal
applications, so you cannot use "Class.forName(String)", you have to use
"this.getClass.forName(String)", or in the static context (HDX does this),
to get the correct ClassLoader for "Class.forName(String,boolean,ClassLoader)"
you need to use "Thread.currentThread().getContextClassLoader()".
My reading of this is that the system class loader (which is what
Class.forName(String) returns), only sees the libraries installed as part
of the local JVM, to see classes downloaded by webstart you need to talk
to a classloader further down the chain (so asking something local for its
classloader works).
Other gotchas for webstart are that _everything_ has to be in a downloaded
jar file and JNI libraries cannot depend on other JNI libraries.
So you cannot use external files for configuration etc. you need to use
"ClassLoader.getResource(String)", to locate resources and read them
(there are a few places where this isn't done, SPLAT's line identifiers
for instance are stored the the etc/splat directory, I still need to work
around that). SPLAT's JNI library for accessing NDFs cannot be used a this
depends on JNIAST, which webstart doesn't allow it to find (so you're
still in a sandbox of sorts it seems).
If we think this looks workable, the next stage would be to see how much
of this could be built into the ANT development system (I haven't looked
at JNLP extensions, which look like they should map naturally into our
idea of packages, this should help with dependency maintenance).
Cheers,
Peter.
|