本文介绍了无法在Intellij中运行Main类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下项目结构
-ProjectRoot ---src ------Main ------examples ---libs我的 src 文件夹在Intellij中被标记为 sources .
My src folder is marked as sources in Intellij.
现在,当我想运行Main class时,出现以下错误:
Now, when I want to run Main class, I get the following error:
Exception in thread "main" java.lang.ClassNotFoundException: Main关于我在做什么错的任何想法?
Any ideas on what am I doing wrong?
这是我的主班:
public class Main { public static void main(String[] args) { System.out.println("hello world"); } }它没有任何包装声明.
推荐答案清理项目,编辑运行配置,再次手动选择主类.如果您具有 src/main/java 结构,则可能不需要.
Clean the project, edit run configuration, choose the main class manually again. This probably wouldn't be needed if you had src/main/java structure.
更多推荐
无法在Intellij中运行Main类
发布评论