My navigate method doesn't work javafx <p>I have program in javafx.</p> <p>Its a note program and I have button switch to another scene but it doesn't work don't know why. When I click, I got a run time error, it was working well.</p> <p><strong>This is the main controller:</strong></p> <pre><code>package notetakingapp; public class ListNotesUIController implements Initializable { @FXML private TableView&lt;Note&gt; tableView; @FXML private TableColumn&lt;Note, String&gt; titleColmun; @FXML private TableColumn&lt;Note, String&gt; descriptionColumn; @FXML private TextField searchNotes; @FXML private Label totalNotes; @Override public void initialize(URL url, ResourceBundle rb) { FilteredList&lt;Note&gt; filteredData = new FilteredList&lt;&gt;(data, n -&gt; true); tableView.setItems(filteredData); totalNotes.setText("" + data.size() + " Notes"); titleColmun.setCellValueFactory(new PropertyValueFactory&lt;&gt;("title")); descriptionColumn.setCellValueFactory(new PropertyValueFactory&lt;&gt;("description")); searchNotes.setOnKeyReleased(e -&gt; { filteredData.setPredicate(n -&gt; { if (searchNotes.getText() == null || searchNotes.getText().isEmpty()) { return true; } return n.getTitle().contains(searchNotes.getText()) || n.getDescription().contains(searchNotes.getText()); }); }); } @FXML private void handleAddNewNoteAction(ActionEvent event) throws IOException { navigate(event, "AddEditUI.fxml"); totalNotes.setText("" + data.size() + " Notes"); } @FXML private void handleEditNotesAction(ActionEvent event) throws IOException { tempNote = tableView.getSelectionModel().getSelectedItem(); navigate(event, "AddEditUI.fxml"); } protected static ObservableList&lt;Note&gt; data = FXCollections.&lt;Note&gt;observableArrayList( new Note("Note 1", "Description of note 41"), new Note("Note 2", "Description of note 32"), new Note("Note 3", "Description of note 23"), new Note("Note 4", "Description of note 14")); protected static Note tempNote = null; protected void navigate(Event event, String FXMLDocName) throws IOException { Parent root = FXMLLoader.load(getClass().getResource(FXMLDocName)); Scene scene = new Scene(root); NoteTakingApp.appStage.setScene(scene); } @FXML private void handleDeleteAction(ActionEvent event) { int getIndex = tableView.getSelectionModel().getSelectedIndex(); data.remove(getIndex); totalNotes.setText("" + data.size() + " Notes"); } } </code></pre> <p><strong>This is the controller what I want to go:</strong></p> <pre><code>package notetakingapp; public class AddEditUIController implements Initializable { @FXML private TextField noteTitle; @FXML private TextArea noteDescription; @FXML private Label noteTitleLabel; @FXML private Label noteDescriptionLabel; @Override public void initialize(URL url, ResourceBundle rb) { noteTitle.setText(tempNote.getTitle()); noteDescription.setText(tempNote.getDescription()); } @FXML private void handleCancleAction(ActionEvent event) throws IOException { navigate(event, "ListNotesUI.fxml"); } @FXML private void handleSaveAction(ActionEvent event) throws IOException { if ((noteTitle.getText().trim().isEmpty()) &amp;&amp; noteDescription.getText().trim().isEmpty()) { noteTitleLabel.setTextFill(Color.BLUE); noteTitleLabel.setText(" * Note Title: (Required)"); noteDescriptionLabel.setTextFill(Color.BLUE); noteDescriptionLabel.setText(" * Note Description: (Required)"); } else { data.add(new Note(noteTitle.getText(), noteDescription.getText())); navigate(event, "ListNotesUI.fxml"); } } protected void navigate(Event event, String FXMLDocName) throws IOException { Parent root = FXMLLoader.load(getClass().getResource(FXMLDocName)); Scene scene = new Scene(root); NoteTakingApp.appStage.setScene(scene); } @FXML private void handleBackToNotesAction(ActionEvent event) throws IOException { navigate(event, "ListNotesUI.fxml"); } @FXML private void handleClearAction(ActionEvent event) { noteTitle.setText(""); noteDescription.setText(""); } } </code></pre> <p><strong>and this is my start method:</strong></p> <pre><code>static Stage appStage = new Stage(); @Override public void start(Stage stage) throws Exception { appStage = stage; Parent root = FXMLLoader.load(getClass().getResource("ListNotesUI.fxml")); Scene scene = new Scene(root); appStage.setScene(scene); appStage.setResizable(false); appStage.setTitle("P'Note-Taking Application v1.0"); appStage.show(); } </code></pre>