我正在學習本教程,但在視頻的早期(大約 7:45)遇到了一個問題。我正在嘗試創(chuàng)建一個將啟動窗口的基本 Java 程序,但是,我似乎無法導入 JFrame。我在 Stack Overflow 上尋找其他解決方案,但沒有找到適合我的解決方案。這是我寫的代碼:import javax.swing.JFrame;public class App { public static void main(String[] args) { JFrame frame = new JFrame("Hello World"); frame.setVisible(true); }}我在運行 macOS Mojave 版本 10.14.5 的 Macbook Pro(13 英寸,2012 年中)上使用 Eclipse 版本 4.12.0預期結(jié)果:程序運行時打開一個窗口,關(guān)閉窗口程序結(jié)束。實際結(jié)果:沒有創(chuàng)建窗口,我收到此錯誤消息:Error occurred during initialization of boot layerjava.lang.module.FindException: Error reading module: /Users/username/eclipse-workspace/Swing1/binCaused by: java.lang.module.InvalidModuleDescriptorException: App.class found in top-level directory (unnamed package not allowed in module)
添加回答
舉報
0/150
提交
取消