简体   繁体   English

导出的Javafx应用程序不能作为Jar文件运行(Eclipse)

[英]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.

相关问题 我使用我的 javafx14 应用程序的 eclipse 导出了可运行的 jar 但无法运行该应用程序 - I exported a runnable jar using eclipse of my javafx14 application but cannot run the application 程序完全在Eclipse中运行,但是当导出为可运行的JAR文件时无法运行 - Program runs completely in Eclipse but does not run when exported as a Runnable JAR file JavaFX - 应用程序:在 Eclipse 中仅显示主要阶段从导出的 jar 文件中显示所有对话框,为什么会出现这种差异? - JavaFX - Application: Only main stage is shown from exported jar file while in Eclipse all dialogs are shown, why this difference? 导出的日食可运行.jar将无法运行 - Exported eclipse runnable .jar will not run 应用程序在Eclipse中运行,导出的jar崩溃 - Application runs in Eclipse, exported jar crashes 导出的(Eclipse)可执行jar文件中的UnsatisfiedLinkError - UnsatisfiedLinkError in exported (Eclipse) executable jar file 带导出的可运行jar文件的Java Eclipse错误 - Java eclipse error with exported runnable jar file 程序可以在eclipse中运行,但是不能导出到jar文件中 - program works in eclipse but not after exported into a jar file 声音会在 Eclipse 中播放,但不会在导出的 jar 文件中播放 - sound will play in eclipse but not in exported jar file 为什么我的 JAR 文件没有运行? (IntelliJ, JavaFX, Maven) - Why does my JAR file not run? (IntelliJ, JavaFX, Maven)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM