0

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 : enter image description here enter image description here

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.

enter image description here

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]
Community
  • 1
  • 1
Jannis Alexakis
  • 1,279
  • 4
  • 19
  • 38
  • about that output-behaviour of the exe-file: `have executed the .exe from the command line, redirecting output, but the output file is always empty.`: you can't do anything about it, I've dig into this already: http://stackoverflow.com/questions/31537869/write-to-console-from-a-native-javafx-app-created-with-inno-setup-and-maven/34476175#34476175 – FibreFoX Feb 24 '16 at 09:59
  • Please edit your answer by providing what's inside generated `app/RCWStats.cfg` – FibreFoX Feb 24 '16 at 10:01
  • Could you provide a reproducable project? http://stackoverflow.com/help/mcve – FibreFoX Feb 24 '16 at 10:02
  • @FibreFox I edited RCWStats.cfg into the question. I can´t reproduce the behaviour though: every other JavaFX project I start in Netbeans packages, installs and runs just as expected. – Jannis Alexakis Feb 24 '16 at 14:18

1 Answers1

0

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.

ManoDestra
  • 6,325
  • 6
  • 26
  • 50
  • 1
    Yes, it would appear that the jar is fine, although the package of main.java is unusual. If you can run java -jar RCWStats.jar and hit your main class, then it's clearly accurately defined. Something would then appear to be wrong in the .exe in terms of how it is calling your class. I would agree with you on that. – ManoDestra Feb 24 '16 at 14:27
  • 2
    I can second the way of checking the jar. It happened to me too, that running the normal jar was working, but when having to fight with dependencies (other JARs), there is no better way to call `java -jar RCWStats.jar` inside your `app`-folder. The MANIFEST gives all information for bootstrapping your javafx-application, therefor running is needed. Maybe there is some JAR missing which is present inside the runtime while launching from your IDE – FibreFoX Feb 24 '16 at 14:44