在运⾏java程序时,出现了错误“selection does not contain a main type”。

是因为.java⽂件不在项⽬的src路径内,也就是说源代码未被eclipse编译,字节码不存在⽆法运⾏了。

我在新建java project时默认勾选的是Create separate folders for sources and class files。

事实上,不应使⽤默认项,应勾选Use project folder for sources and class files。

1e46928e42d34eb9b74ffd0d3a9cd3b8.png

 

Logo

鸿蒙生态一站式服务平台。

更多推荐