无法在Intellij中运行Main类

编程入门 行业动态 更新时间:2024-10-25 04:13:40
本文介绍了无法在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类

本文发布于:2023-11-25 05:49:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628564.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Intellij   Main

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!