Hi Szabolcs,

The problem is that after a native library is loaded, you can not load a
library with the same name. Other Java-based frameworks (e.g. servlets)
where packages are restarted or updated without restarting JVM have the same
problem. I did not find a way to unload a library on demand such that it can
be reloaded again (let me know if you find how to do this). Two (ugly)
workarounds for this problem:

1. If you need to load the exact same version of the native library as was
already loaded then this exception can be caught and ignored. The actual
exception thrown by System.loadLibrary is UnsatisfiedLinkError so you'll
have to look at the message text to know if the reason is that the library
is already loaded or there is a different problem.

2. Make a copy of your library with a unique name and load it from the copy.

Regards,
Boris

----- Original Message ----- 
From: "Szabolcs Tahin" <[EMAIL PROTECTED]>
To: <javax-usb-devel@lists.sourceforge.net>
Sent: Monday, January 10, 2005 10:49 AM
Subject: [javax-usb-devel] Shared lib question


> Greetings to the group,
>
> I`m a student using JSR80 with Java 1.5.0 for my diploma thesis in a OSGi
> environment. By reloading of my program the following error message occur:
>
>  javax.usb.UsbException: Error while loading shared library libJavaxUsb.so
:
> Native Library /usr/lib/java/jre/lib/i386/libJavaxUsb.so already loaded in
> another classloader
>
> I`m sure you know much more about this issue than me, including how to fix
it
> ;-). Should I change something in the source of JSR80 or apply some tricks
in
> my program?
> Any hints appreciated.
>
> Thanks in advance, cheers-----------Szabolcs
>
>
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> _______________________________________________
> javax-usb-devel mailing list
> javax-usb-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
>



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

Reply via email to