简体   繁体   中英

Packaging a JavaFX8 application with Netbeans

Here is the situation: I have a JavaFX8 application, made with Netbeans 8.1. The application runs/debugs within Netbeans without a problem. When I package the application as .EXE (or .MSI, same error), I get the .exe install file without errors. The installer installs the application with the expected folder structure:

+-- RCWStats
\+-- app
     \+--lib (contains all needed jars)
     \---RCWStats.jar
     \---RCWStats.cfg
\+--runtime
    \+--bin
    \+--lib
\---RCWStats.exe

When I try to run the application by executing the RCWStats.exe file, I get these : 在此处输入图片说明 在此处输入图片说明

However, when I execute the RCWStats.jar in /app, it starts without errors, which I find puzzling.

I have found a similar question in SO, namely this one , but the solutions and comments in there didn´t help me: I have executed the .exe from the command line, redirecting output, but the output file is always empty. I have triple-checked the main-class-setting in Netbeans, it´s correct. Also, my external libraries are generated correctly, so I don´t have to tweak my build.xml.

EDIT: additional info

I opened the JAR, the main class is where it is supposed to be. The manifest is also correct. Pic attached. To be honest, since the JAR is working fine, I suspect the problem is in the .exe, it somehow doesn´t find or execute the JAR correctly. Since the packaging process is more or less a blackbox, I´m kinda stuck.

在此处输入图片说明

Manifest-Version: 1.0
Implementation-Title: RCWStats
Implementation-Version: 1.0
Permissions: sandbox
Codebase: *
JavaFX-Version: 8.0
Class-Path: lib/eclipselink.jar lib/iText-4.2.0-com.itextpdf.jar lib/j
 avax.persistence_2.1.0.v201304241213.jar lib/mysql-connector-java-5.1
 .6-bin.jar lib/org.eclipse.persistence.jpa.jpql_2.5.2.v20140319-9ad6a
 bd.jar
Created-By: JavaFX Packager
Implementation-Vendor: jalexakis
Main-Class: main.java.RCWStats

EDIT 2: RCWStats.cfg

[Application]
app.name=RCWStats
app.mainjar=RCWStats.jar
app.version=1.0
app.preferences.id=main/java
app.mainclass=main/java/RCWStats
app.classpath=lib/eclipselink.jar;lib/iText-4.2.0-com.itextpdf.jar;lib/javax.persistence_2.1.0.v201304241213.jar;lib/mysql-connector-java-5.1.6-bin.jar;lib/org.eclipse.persistence.jpa.jpql_2.5.2.v20140319-9ad6abd.jar
app.runtime=$APPDIR\runtime
app.identifier=main.java

[JVMOptions]

[JVMUserOptions]

[ArgOptions]

I would check the classes contained in the jar first and foremost and ensure that the RCWStats class is located in the right place. Check the manifest also to see what the main class is defined as and that it matches what you expect from NetBeans itself. And ensure that your runtime classpath is defined. Without seeing the contents of the jar, knowing your classpath settings, etc, it's difficult to suggest more. If you could embellish on these, perhaps it may become clearer and easier to answer? Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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