Thread: [Openjnlp-devel] ClassLoader, Native Methods, and Java 1.1
Brought to you by:
kherr
From: Doug Z. <dz...@ho...> - 2001-11-20 06:27:03
|
> On Saturday, November 3, 2001, at 11:31 , Doug Zwick wrote: > > [...] > > I've got a Java app (Mac OS9) that uses a JNI library, and I'm trying > > to get it to > > work with OpenJNLP 0.4. As stated in the doc, this does not work (I'm > > getting an > [...] > > be a problem with the ClassLoader implementation. If this is the case, > > is there a > > mod I can apply to FileCacheClassLoader so my app can at least start > > hobbling along > > until native lib support is released? I looked in CVS and didn't see > > anything new > > since 0.4. > > You are absolutely correct about this, it is a limitation of OpenJNLP's > class loader. This is being added to the next version, which is making > progress. There are other things being done as well, the class loader > work hasn't started yet. I'd suspect you'll see some class loader > changes in CVS this week. I've just been looking at the recent update to FileCacheClassLoader, and its one of the Java-2-only changes (java.net.URLClassLoader is 1.2+). We are getting pressure to demo something under OS 9. Is the limitation of the old FileCacheClassLoader something that can be hacked around? I'm not yet clear on why the old code is failing when a native method is called. Any hints at a work-around would be greatly appreciated, or pointers to documentation on the inner workings of a ClassLoader. -DCZ |
From: Kevin H. <ke...@na...> - 2001-11-20 21:04:38
|
On Tuesday, November 20, 2001, at 12:26 , Doug Zwick wrote: [...] > I've just been looking at the recent update to FileCacheClassLoader, and > its one of the Java-2-only changes (java.net.URLClassLoader is 1.2+). We Yes, this is a temporary situation, as the JDK1.1 version of OpenJNLP is forking from the Java2 version. As soon as cache updating by last modified date is implemented (JNLP refers to this as "basic" downloading) the JDK1.1 target will be added. This should happen within a few days since the basic downloading is nearly done. > are getting pressure to demo something under OS 9. Is the limitation of > the old FileCacheClassLoader something that can be hacked around? I'm > not yet clear on why the old code is failing when a native method is > called. Any hints at a work-around would be greatly appreciated, or The inner workings of handling native libraries is a bit involved, especially for Java 1.1 platforms. Java2 class loaders can implement ClassLoader.findLibrary() to return an appropriate location for the nativelib, but this is not the case with Java 1.1. Trying to get nativelib stuff working in OpenJNLP for both Java2 and Java 1.1 are high on the list, but is it worth holding up the next release? I could go either way since more and more people want nativelib support, but it's difficult to test. > pointers to documentation on the inner workings of a ClassLoader. A description of how native stuff works for Java 1.1 is at <http://java.sun.com/docs/books/tutorial/native1.1/index.html>. |
From: Doug Z. <dz...@ho...> - 2001-11-21 07:35:07
|
At 2:04 PM -0700 11/20/01, Kevin Herrboldt wrote: >The inner workings of handling native libraries is a bit involved, >especially for Java 1.1 platforms. Java2 class loaders can implement >ClassLoader.findLibrary() to return an appropriate location for the >nativelib, but this is not the case with Java 1.1. Trying to get >nativelib stuff working in OpenJNLP for both Java2 and Java 1.1 are high >on the list, but is it worth holding up the next release? I could go >either way since more and more people want nativelib support, but it's >difficult to test. I guess I wasn't very clear. I'm looking for suggestions on how I can hack the 0.4 class loader to handle native methods, not asking your team to shuffle the schedule and move it up. I feel bad enough dragging you away to answer these questions! >> pointers to documentation on the inner workings of a ClassLoader. > >A description of how native stuff works for Java 1.1 is at ><http://java.sun.com/docs/books/tutorial/native1.1/index.html>. Am I missing something? I thought that page was just the basics of JNI, I could find nothing there on how the native code actually gets loaded. If you have a link to a page on that subject, I would appreciate your sharing it. -DCZ |
From: Kevin H. <ke...@na...> - 2001-11-21 18:52:23
|
On Wednesday, November 21, 2001, at 01:34 , Doug Zwick wrote: [...] > I guess I wasn't very clear. I'm looking for suggestions on > how I can hack the 0.4 class loader to handle native methods, > not asking your team to shuffle the schedule and move it up. > I feel bad enough dragging you away to answer these questions! Don't feel bad! I really appreciate getting direction from users who need features. User feedback helps to keep motivation high and development active (four months since the last release is terrible!). As to adding nativelib support I think I failed to respond clearly, actually. Here's basically what needs to be done: 1) The nativelib resource needs to be downloaded to the local filesystem. 2) System.loadLibrary() needs to be called with the path to the local version of the library. 3) calls to native methods provided by that library should magically work. You could accomplish this yourself within your own code as a short-term solution, I think. Especially since OpenJNLP doesn't have any security checking. [...] > Am I missing something? I thought that page was just the basics of > JNI, I could find nothing there on how the native code actually gets > loaded. If you have a link to a page on that subject, I would > appreciate your sharing it. Start here: <http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/step5.html>. That should help. Finally, there is a good chance nativelib stuff will happen with OpenJNLP much, much sooner than expected. I've been in contact with some colleagues who've done a lot of work in this area and they've been providing some good insight. |