Java使用Eclipse出现editor does not contain a main type解决

  • run时出现editor does not contain a main type

原因:当前源代码没有整合进package,即没有build path

  • 部分已经build path,但新写的代码没有

解决方案

  • 若已经有build path(有红褐色标记),则先Remove;没有(全白)则忽略
  • src(右键)-> build path -> remove from build path

  • 此时,src文件全部变白
  • 然后点击:src(右键)-> build path -> use as source folder
    在这里插入图片描述

完成效果

发布了36 篇原创文章 · 获赞 11 · 访问量 3527

猜你喜欢

转载自blog.csdn.net/gzn00417/article/details/104170441