[英]UnsatisfiedLinkError: Native Library sunmscapi.dll already loaded in another classloader
I have the following scenario: a Java Desktop application which invokes a Java Legacy class using Reflection. 我有以下情形:一个Java桌面应用程序,该应用程序使用Reflection调用Java Legacy类。 The legacy module executes some native operations (access to Smart Card).
旧版模块执行一些本机操作(访问智能卡)。
Everything works fine when running on Eclipse: I have my Java Desktop application as a Java project which has a set of libraries including the Java legacy JAR file. 在Eclipse上运行时,一切工作正常:我将Java桌面应用程序作为Java项目,该项目具有一组包含Java旧版JAR文件的库。
Now I have created a runnable JAR file from the Eclipse project: when I try to access the Java Legacy layer, the following error is issued: java.lang.UnsatisfiedLinkError: Native Library sunmscapi.dll already loaded in another classloader 现在,我已经从Eclipse项目中创建了一个可运行的JAR文件:当我尝试访问Java Legacy层时,发出以下错误: java.lang.UnsatisfiedLinkError:本机库sunmscapi.dll已经加载到另一个类加载器中
What really puzzles me is why it works correctly on Eclipse, which is using the same JDK settings as the runnable JAR file ??? 真正令我困惑的是,为什么它在Eclipse上可以正常运行,而Eclipse使用与可运行的JAR文件相同的JDK设置? any help
任何帮助
Actually Eclipse is not executing a runnable JAR file when launching application, but just adding the single classpath entries (see the .classpath file). 实际上,Eclipse在启动应用程序时不会执行可运行的JAR文件,而只是添加单个类路径条目(请参阅.classpath文件)。 Try to export the Desktop application ONLY in the jar file and then add all the other libs (incuding the legacy app) with -classpath.
尝试仅在jar文件中导出桌面应用程序,然后使用-classpath添加所有其他库(包括旧版应用程序)。 Then you have the same environment as Eclipse and they should not differ in the output.
然后,您将拥有与Eclipse相同的环境,并且它们的输出不应有所不同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.