Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > [Q] unLoadLibrary ?

Reply
Thread Tools

[Q] unLoadLibrary ?

 
 
obladi
Guest
Posts: n/a
 
      06-14-2004
Hi. I'm using DLL through JNI. However, when I got an Exception before
calling the DLL library, there is a "java.lang.UnsatisfiedLinkError: xxx.dll
already loaded in another classloader". Of course, it wokrs perfectly when
there is no Exception. How can I get this stuff work fine? Is there any
method something like "unloadLibrary" ?
 
Reply With Quote
 
 
 
 
Steve W. Jackson
Guest
Posts: n/a
 
      06-16-2004
In article <(E-Mail Removed) >,
http://www.velocityreviews.com/forums/(E-Mail Removed) (obladi) wrote:

>:Hi. I'm using DLL through JNI. However, when I got an Exception before
>:calling the DLL library, there is a "java.lang.UnsatisfiedLinkError: xxx.dll
>:already loaded in another classloader". Of course, it wokrs perfectly when
>:there is no Exception. How can I get this stuff work fine? Is there any
>:method something like "unloadLibrary" ?


There is no explicit way I know of to unload a library. But there may
be some alternatives.

This is purely speculation, as the library loaded in my app is in a
class that's going to exist for the life of the app. But it occurs to
wonder if the library would get unloaded when the class is garbage
collected. I have no idea whether that's true or not -- just a thought.

The other thought is to simply set a boolean someplace (perhaps a static
member variable in some class you can access from everywhere) indicating
that it's been loaded and thus prevent attempts from elsewhere.

= Steve =
--
Steve W. Jackson
Montgomery, Alabama
 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      06-16-2004
On Wed, 16 Jun 2004 15:06:25 -0500, "Steve W. Jackson"
<(E-Mail Removed)> wrote or quoted :

>The other thought is to simply set a boolean someplace (perhaps a static
>member variable in some class you can access from everywhere) indicating
>that it's been loaded and thus prevent attempts from elsewhere.


you could also do the loadLibrary in a static init block.
Then it will get called only once.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments