当前位置:网站首页>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.
边栏推荐
- STK8321 I2C (Shengjia-accelerometer) example
- MYSQL two-phase commit
- Item 36: Specify std::launch::async if asynchronicity is essential.
- Introduction to the five data types of Redis
- Four ways the Metaverse is changing the way humans work
- 高维高斯分布基础
- Force buckle 2326, 197
- 现代企业架构框架1
- SC7A20(士兰微-加速度传感器)示例
- Compose principle - the view and the principle of two-way data binding
猜你喜欢
STK8321 I2C (Shengjia-accelerometer) example
Euler system (euleros): upgrade Mysql
MYSQL主从复制
cmake入门学习笔记
Key Points Estimation and Point Instance
Google "Cloud Developer Quick Checklist"; Tsinghua 3D Human Body Dataset; SenseTime "Universal Vision Framework" open class; Web3 Minimalist Getting Started Guide; Free Books for Efficient Deep Learni
机器学习初学者可以学哪些实战项目?
【历史上的今天】7 月 31 日:“缸中之脑”的提出者诞生;Wi-Fi 之父出生;USB 3.1 标准发布
【Cryptography/Cryptanalysis】Cryptanalysis method based on TMTO
ECCV2022 Workshop | 复杂环境中的多目标跟踪和分割
随机推荐
C string array reverse
GDB source code analysis series of articles five: dynamic library delay breakpoint implementation mechanism
cmake入门学习笔记
解决IDEA默认情况下新建文件时,右击,new,没有XML文件的问题
MYSQL-Batch insert data
Js replication
MYSQL查询截取优化分析
RTL8762DK 使用DebugAnalyzer(四)
考研备考方案
LeetCode每日一练 —— 环形链表问题(面试四连问)
MYSQL-批量插入数据
Google engineer fired for claiming AI awareness: breach of nondisclosure agreement
Inheritance Considerations
谷歌『云开发者速查表』;清华3D人体数据集;商汤『通用视觉框架』公开课;Web3极简入门指南;高效深度学习免费书;前沿论文 | ShowMeAI资讯日报
STK8321 I2C (Shengjia-accelerometer) example
Inheritance and friend, static member relationship
Exam preparation plan
leetcode:1562. 查找大小为 M 的最新分组【模拟 + 端点记录 + 范围合并】
gateway gateway cross domain
JS时间戳的意义是什么?知道sql会考虑加时间戳,JS的时间戳用于什么场景?