当前位置:网站首页>The IDEA can't find or unable to load The main class or Module "*" must not contain The source root "*" The root already belongs to The Module "*"
The IDEA can't find or unable to load The main class or Module "*" must not contain The source root "*" The root already belongs to The Module "*"
2022-08-01 01:19:00 【Apple-yeran】
I used IDEA to write code today, but the runtime always prompts error: the main class could not be found or could not be loaded
. Baidu and Google have tried all the methods, but they can't solve it. I'm crazy.
After calming down and thinking for a while, click under IDEAout/production
directory, found the problem:
There is an arrow on the left side of the previous module after compilation, indicating that there are files (.class files) in it, but the module in question, that is, Day15_exception, has no arrow, Indicating the bytes generated by the compilationThe code file did not go to this directory, so I checked the IDEA path again and found that there was no problem, which made me even more confused.
It suddenly occurred to me that when I first created the module, the name of the module was Day15_exception, and the code was written to run. Later, I found that it was different from my previous naming convention (the first letter was capitalized), and then I changed it again to become Day15_Exception, as followsPictured:
but out/productionThe name in the
directory is still Day15_exception, so I changed the name under out/production
to Day15_Exception, but it still doesn't work!!!
More crazy!!!
After fiddling for a while, I thought it was still a path problem, so I changed the path of the module Day15_Exception from the path of the inherited project to the manually set path, as shown below:
Click apply, the following error appears:
means that JavaSE this module cannot contain the source root node Day15_Exception\src, this rootThe node already belongs to the Day15_Exception module
, the solution is as follows:
Finally, click apply, ok, re-run, and it can run normally.
Summary: Compilation output path in IDEA
IDEA's default compilation output path is the path of the inherited project:
Path to project:
So by default, the bytecode file generated by the java file compilation in the submodule is in the project path\production\module path
, where production is automatically generated.For example, the bytecode file generated by compiling the java file in the Day15_Exception module is located at: D:\Java\JavaSE\out\production\Day15_Exception\package name of all levels\MainClass.class
.
Of course, instead of using the default path (inheriting the path of the project), you can set the path yourself, as shown below:
Recommended: use the default inherited project path.
边栏推荐
- 元宇宙改变人类工作模式的四种方式
- leetcode:1648. 销售价值减少的颜色球【二分找边界】
- Application of integrated stepper motor in UAV automatic airport
- MYSQL transactions
- IDEA 找不到或无法加载主类 或 Module “*“ must not contain source root “*“ The root already belongs to module “*“
- 【元胞自动机】基于matlab界面聚合元胞自动机模拟【含Matlab源码 2004期】
- 数据中台建设(七):数据资产管理
- leetcode: 1562. Find latest grouping of size M [simulation + endpoint record + range merge]
- Flink 部署和提交job
- What is the meaning of JS timestamp?Know SQL will consider to add a timestamp, JS timestamp for the scene?
猜你喜欢
WeChat applet page syntax
Summary of JVM interview questions (continuously updated)
how to edit the table of contents of an epub ebook
cmake入门学习笔记
You need to know the TCP wave four times
你需要知道的 TCP 四次挥手
【密码学/密码分析】基于TMTO的密码分析方法
MYSQL Keyword Explain Analysis
RTL8762DK 使用DebugAnalyzer(四)
Modern Enterprise Architecture Framework 1
随机推荐
MYSQL事务
Detailed explanation of TCP protocol
蓝图:杨辉三角排列
MYSQL logical architecture
Euler system (euleros): upgrade Mysql
MYSQL Keyword Explain Analysis
谷歌『云开发者速查表』;清华3D人体数据集;商汤『通用视觉框架』公开课;Web3极简入门指南;高效深度学习免费书;前沿论文 | ShowMeAI资讯日报
【 】 today in history: on July 31, "brains in vats" the birth of the participant;The father of wi-fi was born;USB 3.1 standard
Notes on how to use zeno
High dimensional Gaussian distribution basics
高维高斯分布基础
What is the meaning of JS timestamp?Know SQL will consider to add a timestamp, JS timestamp for the scene?
Carefully summarize thirteen suggestions to help you create more suitable MySQL indexes
Blueprint: Yang Hui's Triangular Arrangement
C字符串数组反转
leetcode: 1562. Find latest grouping of size M [simulation + endpoint record + range merge]
Rasa 3.x Study Series - Rasa - Issues 4898 Study Notes
RTL8762DK 点灯/LED(三)
Introduction to the five data types of Redis
Fat interface in JQESAP system