本文介绍了本地库已加载在另一个类加载器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些帮助来处理以下情形。

I need some help to handle following scenario.

我使用的要求相同的本地库中有两个小程序文件(.dll)文件。

I am using two applets which requires the same native library (.dll) file.

所以,当我运行网页上的小程序,首次第一小应用程序加载DLL插入小程序类加载器。它工作正常。
但是,当第二小应用程序试图加载它给了我异常同一个DLL说错误加载win32com:java.lang.UnsatisfiedLinkError中:本地库C:\\ WINDOWS \\ SYSTEM32 \\ win32com.dll已经装载在另一个类加载器

So when I run the applets from the web pages, for the first time first applet loads the dll into the applet class loader. It works fine.But when second applet tries to load the same dll it gives me exception saying that "Error loading win32com: java.lang.UnsatisfiedLinkError: Native Library C:\WINDOWS\system32\win32com.dll already loaded in another classloader"

我用下面的方法来加载驱动程序。

I using following method to load the driver.

CommDriver driver = (CommDriver)Class.forName("com.sun.comm.Win32Driver").newInstance();
driver.initialize();

请给我的解决方案

感谢和放大器; RGDS,
瑞诗凯诗

Thanks & Rgds,Rishikesh

推荐答案

有在加载本地库(作为事实上的任何库)在不同的地点两次是没有意义的。
您可以 Applet1的 *的司机的*对象的静态。结果
而在使用它的 Applet2

There is no point in loading the Native Library(as a matter of fact any library)twice in different locations.You can make Applet1's *driver* object as static.
And use it in Applet2.

这篇关于本地库已加载在另一个类加载器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 07:51