当前位置:网站首页>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.
边栏推荐
- Introduction to the five data types of Redis
- July Bootcamp (Day 31) - Status Compression
- Modern Enterprise Architecture Framework 1
- C string array reverse
- Item 36: Specify std::launch::async if asynchronicity is essential.
- leetcode: 1562. Find latest grouping of size M [simulation + endpoint record + range merge]
- Classes and Objects: Above
- Inheritance Considerations
- YOLO怎么入门?怎么实现自己的训练集?
- MYSQL逻辑架构
猜你喜欢

从零造键盘的键盘超级喜欢,IT人最爱

In 2022, the latest eight Chongqing construction members (electrical construction workers) simulation question bank and answers

SC7A20(士兰微-加速度传感器)示例

RTL8762DK UART(二)

RTL8762DK UART (two)

Introduction to the five data types of Redis

Euler system (euleros): upgrade Mysql

谷歌『云开发者速查表』;清华3D人体数据集;商汤『通用视觉框架』公开课;Web3极简入门指南;高效深度学习免费书;前沿论文 | ShowMeAI资讯日报

Beijing suddenly announced that yuan universe big news

Google engineer fired for claiming AI awareness: breach of nondisclosure agreement
随机推荐
OSD read SAP CRM One Order application log way of optimization
谷歌『云开发者速查表』;清华3D人体数据集;商汤『通用视觉框架』公开课;Web3极简入门指南;高效深度学习免费书;前沿论文 | ShowMeAI资讯日报
MYSQL Keyword Explain Analysis
MYSQL Classic Interview Questions
MYSQL索引解析
【密码学/密码分析】基于TMTO的密码分析方法
Nmap 操作手册 - 完整版
IDEA 找不到或无法加载主类 或 Module “*“ must not contain source root “*“ The root already belongs to module “*“
元宇宙改变人类工作模式的四种方式
MYSQL关键字Explain解析
You need to know the TCP wave four times
Introduction to the five data types of Redis
IDEA调试
WAASAP WebClient UI页面标签的决定逻辑介绍
Web3.0: Building an NFT Market (1)
MYSQL查询截取优化分析
js 实现复制功能
GDB 源码分析系列文章五:动态库延迟断点实现机制
MYSQL transactions
如何编辑epub电子书的目录