I have been trying to create an app using JavaFX, JavaFX fxml application on Netbeans, I'm using java 8, and Javafx SDK 20, the output shows build successful, but the exe doesn't show up.
This is the output code. I don't understand what is the issue and no idea how to fix it.
ant -f C:\Users\youse\hotelManagementProject jfxsa-runjfxsa-run:Buildfile: C:\Users\youse\hotelManagementProject\build.xml
-mark-project-state-running:
-check-jfxrt-in-fxsdk-jre:
-set-jfxrt-in-fxsdk-jre-old:
-set-jfxrt-in-fxsdk-jre-new:
-check-jfxrt-in-fxsdk-rt:
-set-jfxrt-in-fxsdk-rt-old:
-set-jfxrt-in-fxsdk-rt-new:
-check-jfxrt-in-platform-home-jre:
-set-jfxrt-in-platform-home-jre-old:
-set-jfxrt-in-platform-home-jre-new:
-check-jfxrt-in-platform-home-rt:
-set-jfxrt-in-platform-home-rt-old:
-set-jfxrt-in-platform-home-rt-new:
-check-jfxrt-modules-in-platform-home:
-set-jfxrt-modules-in-platform-home:
-check-jfxrt-in-jre:
-set-jfxrt-in-jre-old:
-set-jfxrt-in-jre-new:
-set-jfxrt-in-jre-mods:
-check-jfxrt-in-envjdk-jre:
-set-jfxrt-in-envjdk-jre-old:
-set-jfxrt-in-envjdk-jre-new:
-check-jfxrt-modules-in-envjdk:
-set-jfxrt-modules-in-envjdk:
-pre-check-jfx-runtime:
-check-jfx-runtime:
-check-project:
-warn-of-preloader:
-post-init:
-init-check:
-init-ap-cmdline-properties:
-init-macrodef-modulename:
-init-source-module-properties:
-init-macrodef-javac-with-module:
-init-macrodef-javac-with-processors:
-init-macrodef-javac-without-processors:
-init-macrodef-javac:
-init-macrodef-test-impl:
-init-macrodef-junit-init:
-init-test-properties:
-init-macrodef-junit-prototype-with-module:
-init-macrodef-junit-prototype-without-module:
-init-macrodef-junit-single:
-init-macrodef-junit-batch:
-init-macrodef-junit:
-init-macrodef-junit-impl:
-init-macrodef-testng:
-init-macrodef-testng-impl:
-init-macrodef-test:
-init-macrodef-junit-debug-impl:
-init-macrodef-test-debug-junit:
-init-macrodef-testng-debug:
-init-macrodef-testng-debug-impl:
-init-macrodef-test-debug-testng:
-init-macrodef-test-debug:
-init-debug-args:
-init-macrodef-nbjpda:
-init-macrodef-debug:
-init-macrodef-java-with-module:
-init-macrodef-java-with-unnamed-module:
-init-macrodef-java-without-module:
-init-macrodef-java:
-init-presetdef-jar:
-init-ap-cmdline-supported:
-init-ap-cmdline:
init:
-deps-jar-init:[delete] Deleting: C:\Users\youse\hotelManagementProject\build\built-jar.properties
deps-jar:
-warn-already-built-jar:[propertyfile] Updating property file: C:\Users\youse\hotelManagementProject\build\built-jar.properties
-check-automatic-build:
-clean-after-automatic-build:
-verify-automatic-build:
-pre-pre-compile:
-pre-compile:
-copy-persistence-xml:
-compile-depend:
-do-compile:
-post-compile:
compile:
-pre-jar:
-check-module-main-class:
-set-module-main-class:
-pre-pre-jar:
-do-jar-create-manifest:
-do-jar-copy-manifest:
-do-jar-set-mainclass:
-do-jar-set-profile:
-do-jar-set-splashscreen:
-check-do-mkdist:
-do-jar-jar:
-init-macrodef-copylibs:
-do-jar-copylibs:
-do-jar-delete-manifest:
-do-jar-without-libraries:
-do-jar-with-libraries:
-jfx-copylibs-warning:
-jfx-copylibs:[delete] Deleting directory C:\Users\youse\hotelManagementProject\dist\lib[copy] Copying 1 file to C:\Users\youse\hotelManagementProject\dist\lib
-check-rebase-libs:
-rebase-libs-warning:
-rebase-libs:
-check-ant-javafx-in-fxsdk-lib:
-set-ant-javafx-in-fxsdk-lib:
-check-ant-javafx-in-fxsdk-tools:
-set-ant-javafx-in-fxsdk-tools:
-check-ant-javafx-in-platform-home-lib:
-set-ant-javafx-in-platform-home-lib:
-check-ant-javafx-in-platform-home-tools:
-set-ant-javafx-in-platform-home-tools:
-check-ant-javafx-in-probjdk-lib:
-set-ant-javafx-in-probjdk-lib:
-check-ant-javafx-in-probjdk-tools:
-set-ant-javafx-in-probjdk-tools:
-check-ant-javafx-in-macjdk-lib:
-set-ant-javafx-in-macjdk-lib:
-check-ant-javafx-in-envjdk-lib:
-set-ant-javafx-in-envjdk-lib:
-check-ant-javafx-in-envjdk-tools:
-set-ant-javafx-in-envjdk-tools:
-pre-check-ant-javafx-version:
-check-endorsed-javafx-ant-classpath:
-set-endorsed-javafx-ant-classpath:
-set-javafx-ant-classpath:
-check-ant-javafx-version:
-check-jfx-sdk-version-old:
-check-jfx-sdk-version-new:
-check-jfx-sdk-version:[echo] Detected JavaFX Ant API version 1.3
-check-jfx-deployment:
-check-dist-lib-exists:
-check-jfx-deployment-jar-current-nolib:
-check-jfx-deployment-jar-current-lib:
-check-jfx-deployment-launch:
-do-jfx-deployment-script:
-do-jfx-deployment-noscript:
jfx-deployment:
-post-jar:
-do-jar:
-pre-deploy:
-check-jlink:
-do-deploy:
-post-deploy:
deploy:
jar:
-check-concurrent-runs:
-create-temp-run-dir:
[copy] Copying 4 files to C:\Users\youse\hotelManagementProject\dist\run218081809
jfx-project-run:
[echo] Executing C:\Users\youse\hotelManagementProject\dist\run218081809\hotelManagementProject.jar using platform C:\Users\youse\Downloads\zulu8.68.0.21-ca-fx-jdk8.0.362-win_x64\zulu8.68.0.21-ca-fx-jdk8.0.362-win_x64/bin/java
[java] Exception in Application start method
[java] java.lang.reflect.InvocationTargetException
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:498)
[java] at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
[java] at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[java] at java.lang.reflect.Method.invoke(Method.java:498)
[java] at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:873)[java] Caused by: java.lang.RuntimeException: Exception in Application start method
[java] at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)[java] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$1(LauncherImpl.java:182)
[java] at java.lang.Thread.run(Thread.java:750)[java] Caused by: javafx.fxml.LoadException:[java] file:/C:/Users/youse/hotelManagementProject/dist/run218081809/hotelManagementProject.jar!/hotelmanagementproject/FXMLDocument.fxml
[java]
[java] at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2608)
[java] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2550)
[java] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2448)
[java] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3251)
[java] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3212)
[java] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3185)
[java] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3161)
[java] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3141)
[java] at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3134)
[java] at hotelmanagementproject.HotelManagementProject.start(HotelManagementProject.java:21)[java] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
[java] at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)[java] at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
[java] at java.security.AccessController.doPrivileged(Native Method)[java] at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
[java] at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)[java] at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
[java] at com.sun.glass.ui.win.WinApplication.lambda$null$3(WinApplication.java:178)
[java] ... 1 more[java] Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1][java] Message: Premature end of file.[java] at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:604)[java] at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:88)
[java] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2520)[java] ... 17 more
[java] Exception running application hotelmanagementproject.HotelManagementProject
[java] Java Result: 1
-remove-temp-run-dir:
[delete] Deleting directory C:\Users\youse\hotelManagementProject\dist\run218081809
jfxsa-run-no-another-jvm:
BUILD SUCCESSFUL
Total time: 2 seconds
BUILD SUCCESSFUL (total time: 3 seconds)
The main java file
package hotelmanagementproject;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;import javafx.scene.Scene;
import javafx.stage.Stage;
public class HotelManagementProject extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {launch(args);}
}
css file
.white-bg{-fx-background-color:#fff;}
.left-form{-fx-background-color:linear-gradient(to bottom right, #686c89, #4f4c63);}
.textfield{-fx-background-color:transparent;-fx-border-color:#4f4c63;-fx-border-width:0px 0px .8px 0px;-fx-font-size:13px;-fx-font-family:"Tahoma";}
.textfield:focused{-fx-border-color:linear-gradient(to bottom right, #686c89, #4f4c63);-fx-border-width:0px 0px 1.5px 0px;}
.login-btn{-fx-background-color:linear-gradient(to bottom right, ffffff, #565d91);-fx-text-fill:#fff;-fx-font-size:13px;-fx-cursor:hand;}
.login-btn:hover{-fx-background-color:linear-gradient(to bottom right, ffffff, #2b346e);}
.close{-fx-background-color:transparent;-fx-cursor:hand;}
.close:hover{-fx-background-color:#da0404;}`
FXMLDocumentController.java file
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/javafx/FXML2.java to edit this template
*/
package hotelmanagementproject;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
/**
* @author youse
*/
public class FXMLDocumentController implements Initializable {
@FXMLprivate Label label;
@FXMLprivate void handleButtonAction(ActionEvent event) {System.out.println("You clicked me!");label.setText("Hello World!");}
@Overridepublic void initialize(URL url, ResourceBundle rb) {// TODO}
}
I added the font awesome to the library, as there was an error related to that previously, but then this showed up.