cancel
Showing results for 
Search instead for 
Did you mean: 

Hello, when i run as application my project in Eclipse after create controler pakage it sends this message: Caused by: java.lang.NullPointerException at com.st.myst25app.view.NfcTagController.initialize(NfcTagController.java:29) ... 23 more

JDias
Associate II
 
17 REPLIES 17

The first one is my Project, the second is when i import ST25demo app and third is the message error when i clic in the first line on console. Please see the Picture below.

THANKS

0690X0000088SruQAE.png0690X0000088SrpQAE.png0690X0000088SrkQAE.png

Thanks.

From the last screenshot, we can see that the NullPointerException points to line 29 of the NfcTagController.java file.

This line concerns readerStatusLabel, referring to a node that should exist in the NfcTagView.fxml file.

In JavaFX, the fxml file defines the Graphical User Interface. You can edit the fxml in a text editor or use Gluon's free SceneBuilder app for a GUI editor.

Unfortunately, it looks like the readerStatusLabel is not initialized, which could mean one of 2 things:

  • readerStatusLabel is not defined in the fxml file -> open the NfcTagView.fxml file and check if you can see it.
  • The fxml file has a syntax error that prevents it from loading. Seeing that the null pointer happens at the last line of initialize() instead of the first, this looks unlikely.

Reading the example guide again, I understand the problem now. The fxml file that is given at the beginning of the document does not contain the readerStatusLabel which is introduced in a later chapter. The guide is missing the update of the fxml file (It will be added in the next release, thanks to your intervention). For now, please replace your fxml file with this one:

<?xml version="1.0" encoding="UTF-8"?>
 
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
 
<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.st.myst25app.view.NfcTagController">
   <children>
      <GridPane hgap="5.0" layoutX="12.0" layoutY="87.0" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0">
        <columnConstraints>
          <ColumnConstraints hgrow="SOMETIMES" maxWidth="284.0" minWidth="0.0" prefWidth="90.0" />
          <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="300.0" />
        </columnConstraints>
        <rowConstraints>
            <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
            <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
        </rowConstraints>
         <children>
            <Button fx:id="discoverButton" mnemonicParsing="false" prefWidth="90.0" text="Discover Tag" />
            <Label text="Tag UID:" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
            <Label fx:id="tagUidLabel" text="UID" GridPane.columnIndex="1" GridPane.rowIndex="1" />
            <Label text="EEPROM size:" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
            <Label fx:id="tagSizeLabel" text="Size" GridPane.columnIndex="1" GridPane.rowIndex="2" />
            <Button fx:id="writeNdefButton" mnemonicParsing="false" prefWidth="90.0" text="Write Uri" GridPane.rowIndex="3" />
            <Label fx:id="writeStatusLabel" text="Status" GridPane.columnIndex="1" GridPane.rowIndex="3" />
            <Label fx:id="readerStatusLabel" text="Reader Status" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
            <Label text="Detects Iso15693/NFC Forum Type 5 tag" GridPane.columnIndex="1" />
         </children>
      </GridPane>
   </children>
</AnchorPane>

Cheers,

Damien

Hello Damien,

THANK YOU SO MUCH FOR YOUR SUPPORT AND KIND ATTENTION.

Please let me know for next releases.

I apolozise for my late answer.

Hello Damien,

I don't know if did something wrong,but when i import the ST25app and run as java application na error occurs.

Plesae see the pictures below.

Thanks

0690X0000089iuhQAA.jpg0690X0000089iurQAA.jpg0690X0000089iuwQAA.jpg0690X0000089iv1QAA.jpg

Hello and sorry for the late answer,

Could you please post the full Exception stack text from the console (part starting with "Exception in Application start method") until the last line?

Thanks,

Damien

Hello Damien, i appreciate your help.

Please see the pictures below.

Thanks

0690X000008AsMxQAK.jpg0690X000008AsMsQAK.jpg

0690X000008AsMiQAK.jpg

This pictures are with your code fxlml

0690X000008AsN7QAK.jpg0690X000008AsN2QAK.jpg

The UnsatisfiedLinkError occurs when the path environment variable is not set to include the dependency directory.

Please check the answer to this question to update it.