I need help, please! Exception running application

Error:

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:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: javafx.fxml.LoadException: 
/C:/Users/User/Documents/NetBeansProjects/lab/target/classes/com/mycompany/lab/primary.fxml:8

at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:930)
at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:980)
at javafx.fxml/javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:227)
at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:752)
at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2722)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2552)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
at com.mycompany.lab/com.mycompany.lab.App.loadFXML(App.java:31)
at com.mycompany.lab/com.mycompany.lab.App.start(App.java:20)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
... 1 more
Caused by: java.lang.ClassNotFoundException: com.mycompany.lab.PrimaryController
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:928)
... 18 more
Exception running application com.mycompany.lab.App
Command execution failed.

BUILD FAILURE
------------------------------------------------------------------------
Total time:  39.167 s
Finished at: 2021-01-07T20:36:17+01:00
------------------------------------------------------------------------
Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.4:run (default-cli) on project lab: Error: 
Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

класс Main

 package com.mycompany.lab;

import javafx.application.Application; 
import javafx.collections.FXCollections; 
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn; 
import javafx.scene.control.TableView; 
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory; 
import javafx.scene.layout.HBox; 
import javafx.scene.layout.VBox; 
import javafx.stage.Stage;

public class Main extends Application {

Stage window;
TableView<Product> table;
TextField nameInput, priceInput, quantityInput;

public static void main(String[] args) {
    launch(args);
}

@Override
public void start(Stage primaryStage) throws Exception {
    window = primaryStage;
    window.setTitle("thenewboston - JavaFX");
    
    //Name column
    TableColumn<Product, String> nameColumn = new TableColumn<>("Name");
    nameColumn.setMinWidth(200);
    nameColumn.setCellValueFactory(new PropertyValueFactory<>("name"));
    
    //Price column
    TableColumn<Product, Double> priceColumn = new TableColumn<>("Price");
    priceColumn.setMinWidth(100);
    priceColumn.setCellValueFactory(new PropertyValueFactory<>("price")); 
    
    //Quantity column
    TableColumn<Product, String> quantityColumn = new TableColumn<>("Quantity");
    quantityColumn.setMinWidth(100);
    quantityColumn.setCellValueFactory(new PropertyValueFactory<>("quantity"));
    
    //Name input
    nameInput = new TextField();
    nameInput.setPromptText ("Name");
    nameInput.setMinWidth(100);
    
    //Price input 
    priceInput = new TextField();
    priceInput.setPromptText("Price");
    
   //Quantity input
   quantityInput = new TextField();
   quantityInput.setPromptText("Quantity");
   
   //Button 
   Button addButton = new Button("Add");
   addButton.setOnAction(e -> addButtonClicked());
   Button deleteButton = new Button("Delete");
   deleteButton.setOnAction(e -> deleteButtonClicked());
   
   HBox hBox = new HBox();
   hBox.setPadding (new Insets(10,10,10,10));
   hBox.setSpacing(10);
   hBox.getChildren().addAll(nameInput, priceInput, quantityInput, addButton, deleteButton);
   
   table = new TableView<>(); 
   table.setItems(getProduct());
   table.getColumns().addAll(nameColumn, priceColumn, quantityColumn);
   
   VBox vBox = new VBox();
   vBox.getChildren().addAll(table, hBox);
           
   Scene scene = new Scene(vBox) ;
   window.setScene(scene); 
   window.show();
   }
    
   //Add button clicked
   public void addButtonClicked(){
       Product product = new Product();
       product.setName(nameInput.getText());
       product.setPrice(Double.parseDouble(priceInput.getText()));
       product.setQuantity(Integer.parseInt(quantityInput.getText())); 
       table.getItems().add(product);
       nameInput.clear();
       priceInput.clear(); 
       quantityInput.clear();
    }
   
   //Delete button clicked
   public void deleteButtonClicked(){
        ObservableList<Product> productSelected, allProducts; 
        allProducts = table.getItems();
        productSelected = table.getSelectionModel().getSelectedItems();
        
        productSelected.forEach(allProducts::remove);
    }
   
   //Get all of the products
   public ObservableList<Product> getProduct(){
       ObservableList<Product> products = FXCollections.observableArrayList();
       products.add(new Product("Laptop", 3859.00, 47));
       products.add(new Product("TV", 799.49, 21));
       products.add(new Product("Fridge", 4599.00, 18));
       products.add(new Product("Microwave oven", 147.99, 35));
       products.add(new Product("Vacuum cleaner", 230.00, 26));
       return products;
   }      

класс Product

package com.mycompany.lab;

public class Product {

private String name;
private double price;
private int quantity; 

public Product(){
    this.name = "";
    this.price = 0;
    this.quantity = 0;
}

public Product(String name, double price, int quantity){
   this.name = name; 
   this.price = price;
   this.quantity = quantity;
}
   
public String getName() {
    return name;
} 

public void setName(String name) { 
    this.name = name;
 }

public double getPrice() {
    return price;
} 

public void setPrice(double price) {
    this.price = price;
}

public int getQuantity() {
    return quantity; 
}

public void setQuantity(int quantity) {
    this.quantity = quantity;
}

Ответы (0 шт):