当 运行 在空文件夹中时 JXbrowser 初始化失败:java.nio.file.NoSuchFileException:...jxbrowser-browser.log.lck

JXbrowser initialization fails when run in empty folder: java.nio.file.NoSuchFileException:...jxbrowser-browser.log.lck

OS: macOS Sierra 10.12.3 (16D32)

jx浏览器版本:6.14.2

我将 jxbrowser 缓存和日志目录设置为执行的 jar 文件附近的单个文件夹。当它 运行 从头开始​​出现异常时: java.nio.file.NoSuchFileException:...jxbrowser-browser.log.lck

如果 运行 以前的版本 (6.3) 和之后的当前版本,那么一切正常。

[DEBUG] 2017-07-30 15:55:00.411 [main] ScalarSelectOperation - select from result set
Exception in Application init method
java.lang.RuntimeException: Exception in Application init method
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:912)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication5(LauncherImpl.java:182)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.nio.file.NoSuchFileException: /%PATH_TO_JAR_FOLDER%/.cache/jxbrowser-browser.log.lck
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.newFileChannel(UnixFileSystemProvider.java:177)
    at java.nio.channels.FileChannel.open(FileChannel.java:287)
    at java.nio.channels.FileChannel.open(FileChannel.java:335)
    at java.util.logging.FileHandler.openFiles(FileHandler.java:459)
    at java.util.logging.FileHandler.<init>(FileHandler.java:292)
    at ru.mybetter.ui.desktop.BetterClient.redirectLogMessagesToFile(BetterClient.java:174)
    at ru.mybetter.ui.desktop.BetterClient.init(BetterClient.java:106)
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:841)
    ... 2 more

2017-07-30 15:55:00,610 pool-2-thread-1 DEBUG Stopping LoggerContext[name=2a139a55, org.apache.logging.log4j.core.LoggerContext@f5a3839]
2017-07-30 15:55:00,611 pool-2-thread-1 DEBUG Stopping LoggerContext[name=2a139a55, org.apache.logging.log4j.core.LoggerContext@f5a3839]...

根据异常堆栈跟踪,错误来自:

ru.mybetter.ui.desktop.BetterClient.redirectLogMessagesToFile(BetterClient.java:174)

我假设您创建 FileHandler 实例时使用了指向不存在的文件的无效路径。或者,根据 FileHandler(String pattern) 的 Javadoc,当 there are IO problems opening the files.

时,IOException 可以从其构造函数中抛出

请确保您传递给 FileHandler 构造函数的文件路径可从您的 Java 程序访问,并且没有 read/write 权限问题。