英文:
"Error: Could not find or load main class", running on MacOS Catalina
问题
我有一个多模块的应用程序,其中main()函数位于一个类文件中:
// 好吧,我们开心地开始吧......
public static void main(String[] args)
{
// 输出一些数据到标准输出,显示正在发生的情况
System.out.println("模拟开始....");
System.out.println("在恩菲尔德运行,有110人");
Simulation sim = new Simulation(100, "Enfield");
System.out.println("模拟将只执行1次");
sim.run(1);
System.out.println("模拟完成,正在转储结果....");
sim.dump();
}
每次我尝试调试或运行时,我都会得到相同的错误“错误:找不到或加载主类”。我已经多次删除并重新输入调试信息,重启了Eclipse和我的Mac,但仍然无法运行该应用程序。
本站关于类似问题的条目都是5年前的了,现在应该已经解决了(希望如此)。
任何帮助/建议将不胜感激。
英文:
I have a multi module application, with the main() function in one of the class files:
// off we jolly well go ......
public static void main( String args )
{
// output some data to STDOUT to show what's happening
System.out.println( "Simulation starting ...." );
System.out.println( "Running in Enfield with 110 people");
Simulation sim = new Simulation( 100, "Enfield" );
System.out.println( "Simulation will execute 1 time only" );
sim.run( 1 );
System.out.println(" Simulation completed, dumping results ....");
sim.dump();
}
Every time I try and debug or run I get the same error "Error: Could not find or load main class". I have deleted and re-entered the Debug info many times, restarted Eclipse, and my Mac, but still cannot run the app.
The entries about similar problems in this site are all over 5 years old, and must have been fixed by now (hopefully).
Any help/advice would be very welcome.
专注分享java语言的经验与见解,让所有开发者获益!
评论