7 messages in net.java.dev.jna.usersRe: [jna-users] ClassLoaders and jnid...
FromSent OnAttachments
Donszelmann MarkJun 18, 2009 7:12 am 
Timothy WallJun 18, 2009 7:41 am 
Donszelmann MarkJun 18, 2009 9:15 am 
Timothy WallJun 18, 2009 9:43 am 
LYou...@gkservices.comJun 18, 2009 10:30 am.sig
LYou...@gkservices.comJun 18, 2009 10:31 am.sig
Donszelmann MarkJun 21, 2009 6:19 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] ClassLoaders and jnidispatchActions...
From:LYou...@gkservices.com (LYou@gkservices.com)
Date:Jun 18, 2009 10:31:57 am
List:net.java.dev.jna.users
Attachments:
PGP.sig - 0.7k

also, to actually 'make sure' you do System.load(..);

Levi Yourchuck Senior Programmer Analyst G&K Services Phone: 952 912 5828 www.gkservices.com Enhancing Image & Safety Through Innovation This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.

Donszelmann Mark <Mark@slac.stanford.edu> Sent by: Mark Donszelmann <mark@gmail.com> 06/18/2009 11:15 AM Please respond to use@jna.dev.java.net

To use@jna.dev.java.net cc

Subject Re: [jna-users] ClassLoaders and jnidispatch

Hi Timothy,

On Jun 18, 2009, at 4:41 PM, Timothy Wall wrote:

Native libraries may be loaded only once at a time.

ok.

If the class loader which loads com.sun.jna.Native is GC'd (and finalized), the native library will be unloaded , at which point another class loader can load it (this process has been improved somewhat in the code in SVN -- see JNAUnloadTest).

What is the error you are getting? What are you trying to accomplish (i.e. why is JNA being loaded more than once)?

java.lang.UnsatisfiedLinkError: jnidispatch (/com/sun/jna/win32-x86/jnidispatch.dll) not found in resource path

we run this in a program where our users can write their own little java snippets. These we load with a ClassLoader. I guess we need to load the JNA with the system classloader so that it will be available and not unloaded.

If you're running in an application container, you may not have a choice where or when to load things.

we are in control. How do I make sure I load the JNA and the dll in the system classloader up front.

Regards Mark Donszelmann

On Jun 18, 2009, at 10:12 AM, Donszelmann Mark wrote:

Hi

we seem to have a problem loading jnidispatch.dll for the second time.

Reason is (probably) that the classloader that loads the first jna classes gets trashed.

The second classloader tries to find jnidispatch (which we have on our PATH) and does not find it.

Is this at all possible (to load jnidispatch twice), or should we make sure we load jnidispatch from a class loaded by the systemclassloader, and if so, how ?

Regards Mark Donszelmann