繁体   English   中英

显示对话框时,JFileChooser导致UnsatisfiedLinkError

[英]JFileChooser causes UnsatisfiedLinkError when showing dialog

and selecting a File. 我有一个打开并选择一个文件的方法。 method I get an exception, but even so the Dialog opens, I can select a File, and move on with the program (though unless I call at the end the JVM will not stop running). 当调用方法时,我得到一个异常,但是即使对话框打开,我也可以选择一个文件,然后继续执行该程序(尽管除非我在结束时调用 ,否则JVM不会停止运行) 。

public static File selectFile() {
    JFileChooser fc = new JFileChooser(Paths.get("").toAbsolutePath().toFile());
    if(fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { //Exception on This Line!!
        return fc.getSelectedFile();
    } else return null;
}

异常看起来像这样:

Exception in thread "EventQueueMonitor-ComponentEvtDispatch" java.lang.UnsatisfiedLinkError: no EnJavaJni in java.library.path
  at java.lang.ClassLoader.loadLibrary(Unknown Source)
  at java.lang.Runtime.loadLibrary0(Unknown Source)
  at java.lang.System.loadLibrary(Unknown Source)
  at com.encentuate.JNICall.<clinit>(JNICall.java:67)
  at com.encentuate.EncentuateAWTHook.guiInitialized(EncentuateAWTHook.java:41)
  at com.sun.java.accessibility.util.EventQueueMonitor.maybeNotifyAssistiveTechnologies(EventQueueMonitor.java:228)
  at com.sun.java.accessibility.util.ComponentEvtDispatchThread.run(EventQueueMonitor.java:631)

我不太了解问题所在。 从我可以通过Google找到的信息来看,它与调用无法找到的本机函数的方法有关,但是除了抛出Exception之外,它仍然可以按“预期”的方式工作。

关于这个问题有什么线索吗?

编辑:我的主要问题是,即使完成程序也不会停止执行。 如果可以解决,那么继续打印异常消息就不是什么大问题了

这段代码似乎对我有用。 我可以问你从哪里打电话吗? 您在什么操作系统上?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM