无法在Intellij中运行Main类 [英] Cannot run Main class in Intellij
本文介绍了无法在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类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文