0

hi everyone I am new to javaFX I am trying to add fontawesome icon in my JRXML, I have also added jar in my XML file, when I am trying to run it is throwing me exception, refer below code

   <?xml version="1.0" encoding="UTF-8"?>

    <?import javafx.scene.layout.AnchorPane?>
    <?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
    <?import javafx.scene.control.Button?>
    
    <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="327.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
       <children>
            <Button text="Close" AnchorPane.topAnchor="0" AnchorPane.leftAnchor="0">
            <graphic>
                <FontAwesomeIconView glyphName="CLOSE" glyphSize="24"/>
            </graphic>
        </Button>
   </children>
</AnchorPane>

getting below exception, if I remove Icon then it is compiling well and running.

Exception in Application start method
java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:465)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1082)
Caused by: java.lang.RuntimeException: Exception in Application start method
    at 

    ```

enter image description here

Sam
  • 13
  • 3
  • 1
    Try https://kordamp.org/ikonli/. – SedJ601 Aug 26 '23 at 04:28
  • 2
    Post the complete stack trace. You have omitted the root cause. If you don't know how to read a stack trace, see https://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors – James_D Aug 26 '23 at 13:02

0 Answers0