[英]Exported Javafx application does not run as Jar file (Eclipse)
I have a javafx application which is not properly exporting to a runnable jar file from eclipse. 我有一个Javafx应用程序,无法从eclipse正确导出到可运行的jar文件。 When exported the
.jar
file does not properly run and the GUI does not appear. 导出时,
.jar
文件无法正确运行,并且GUI也不会出现。 Below is the Manifest File. 以下是清单文件。
Manifest-Version: 1.0
Class-Path: .
Main-Class: gameaspects.SourceCodeVersion9
Here is the export interface: 这是导出界面:
Exporting the file produces no errors or warnings from eclipse. 导出文件不会因Eclipse产生任何错误或警告。
Running the application from cmd I get the following error: 从cmd运行应用程序时出现以下错误:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
at java.lang.Thread.run(Unknown Source)
Caused by: java.nio.file.NoSuchFileException: .\music
at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(Unknown Source)
at sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(Unknown Source)
at sun.nio.fs.WindowsFileSystemProvider.readAttributes(Unknown Source)
at java.nio.file.Files.readAttributes(Unknown Source)
at java.nio.file.FileTreeWalker.getAttributes(Unknown Source)
at java.nio.file.FileTreeWalker.visit(Unknown Source)
at java.nio.file.FileTreeWalker.walk(Unknown Source)
at java.nio.file.FileTreeIterator.<init>(Unknown Source)
at java.nio.file.Files.find(Unknown Source)
at gameaspects.SourceCodeVersion9.start(SourceCodeVersion9.java:81)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
... 1 more
Exception running application gameaspects.SourceCodeVersion9 运行应用程序gameaspects.SourceCodeVersion9的异常
The code that I believe that this is referring to is this: 我相信这是指的代码是这样的:
List<String> result = Files.find(Paths.get(".\\music"), 100,
(p, a) -> p.toString().toLowerCase().endsWith(".mp3"))
.map(path -> path.toString())
.collect(Collectors.toList());
The .\\music refers to the source folder music
that is present in my application. 。\\ music是指应用程序中存在的源文件夹
music
。
If any other information is needed to diagnose this issue please comment below and I will add it. 如果需要其他任何信息来诊断此问题,请在下面发表评论,我将其添加。
好的,在命令提示符下使用java -jar FileName.jar
,然后使用堆栈跟踪来调试我的代码,我能够在我的应用程序中找到错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.