“错误:无法找到或加载主类”,在 MacOS Catalina 上运行

huangapple 未分类评论53阅读模式
英文:

"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.

huangapple
  • 本文由 发表于 2020年4月6日 01:34:03
  • 转载请务必保留本文链接:https://java.coder-hub.com/61046692.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定