【发布时间】:2020-03-04 20:20:07
【问题描述】:
我对编程很陌生,并且在我正在做的事情上得到了一些帮助。也就是说,现在我的项目没有认识到主要方法在那里。我已经多次确保运行的主类是有效路线,但它似乎仍然没有识别出该文件在那里。没有其他文件识别来自该包的任何导入,并且该包不识别来自其他文件的任何导入。
错误代码
ant -f C:\\Users\\Andrew\\Documents\\NetBeansProjects\\InventorySystem -Dnb.internal.action.name=run run
init:
Deleting: C:\Users\Andrew\Documents\NetBeansProjects\InventorySystem\build\built-jar.properties
deps-jar:
Updating property file: C:\Users\Andrew\Documents\NetBeansProjects\InventorySystem\build\built-jar.properties
Compiling 12 source files to C:\Users\Andrew\Documents\NetBeansProjects\InventorySystem\build\classes
C:\Users\Andrew\Documents\NetBeansProjects\InventorySystem\src\Software1C482\InventorySystem.java:9: error: duplicate class: InventorySystem
public class InventorySystem extends Application {
C:\Users\Andrew\Documents\NetBeansProjects\InventorySystem\src\ViewController\HomeWindowController.java:16: error: cannot access InventorySystem
import Software1C482.InventorySystem;
bad source file: C:\Users\Andrew\Documents\NetBeansProjects\InventorySystem\src\Software1C482\InventorySystem.java
file does not contain class Software1C482.InventorySystem
Please remove or make sure it appears in the correct subdirectory of the sourcepath.
C:\Users\Andrew\Documents\NetBeansProjects\InventorySystem\src\ViewController\HomeWindowController.java:261: error: cannot find symbol
public void setMainApp(InventorySystem mainApp) {
symbol: class InventorySystem
location: class HomeWindowController
C:\Users\Andrew\Documents\NetBeansProjects\InventorySystem\src\module-info.java:21: error: package is empty or does not exist: Software1C482.InventorySystem
exports Software1C482.InventorySystem;
C:\Users\Andrew\Documents\NetBeansProjects\InventorySystem\src\Software1C482\InventorySystem.java:26: error: cannot find symbol
HomeWindowController controller = viewLoader.getController();
symbol: class HomeWindowController
location: class InventorySystem
Note: C:\Users\Andrew\Documents\NetBeansProjects\InventorySystem\src\ViewController\ModifyProductController.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 errors
运行参数是: java -p --add-modules=javafx.graphics,javafx.fxml,javafx.controls -jar inventory.jar
我尝试获取代码层次结构,但 alt+shift+F12 似乎没有任何作用。
【问题讨论】:
-
InventorySystem.java顶部的包声明是什么? -
软件包 Software1C482;