我在同一个文件夹中编写了几个类,这是层次结构:
bookpirate/
-Window.java
-Navigator.java
-NavEventHandler.java
所有文件都有“package bookpirate;” 在一开始的时候
这是我导入它们的方法:
导航器类:
package bookpirate;
import javax.swing.*;
import java.awt.*;
import bookpirate.NavEventHandler;
public class Navigator
{
private JPanel panel;
public JTextField page;
public JButton pageBack;
public JButton addBefore;
public JButton addAfter;
public JButton pageForward;
public JButton removePage;
public JButton undo;
public JTextField getPage() { return page; }
public JButton getPageBack() { return pageBack; }
public JButton getAddBefore() { return addBefore; }
public JButton getAddAfter() { return addAfter; }
public JButton getPageForward() { return pageForward; }
public JButton getRemovePage() { return removePage; }
public JButton getUndo() { return undo; }
public int nOfPages;
public int getNOfPages() { return nOfPages; }
public static void main(String[] args)
{
new Navigator();
}
public Navigator()
{
setListeners();
System.out.println("Created NavEventHandler");
}
这是我编译 NavEnventHandler 时得到的结果:
C:\Users\...\bookpirate>javac NavEventHandler.java
NavEventHandler.java:5: error: cannot find symbol
import bookpirate.Navigator;
^
symbol: class Navigator
location: package bookpirate
NavEventHandler.java:9: error: cannot find symbol
Navigator navigator;
^
一直以来我都可以毫无错误地将它们编译在一起
C:\Users\Falangrater\Desktop\Files\Programming\bookpirate>javac NavEventHandler.java Navigator.java Window.java
C:\Users\Falangrater\Desktop\Files\Programming\bookpirate>
但我无法一起或单独运行它们
C:\Users\Falangrater\Desktop\Files\Programming\bookpirate>java Window Navigator NavEventHandler
Error: Could not find or load main class Window
C:\Users\Falangrater\Desktop\Files\Programming\bookpirate>
我尝试过制作一个manifest.txt文件
Main-Class: Window
我无法将 .mf 添加到文件中
我试图尽可能简洁
天涯尽头无女友
潇湘沐
相关分类