找不到或无法加载主类怎么解决-(找不到或无法加载主类怎么解决java)
如何解决找不到或无法加载主类的问题
(如何解决找不到或无法加载主类的问题java)
JDK-01
已经配置了JAVA_HOME,执行java可操作、执行javac报错。检查PATH有别的吗?jdk如图所示:发现有一条路径oracle的javapath,删除此行即可。
![](https://img.bwb5.com/d/file/p/2022080906002725907/2022080906002725908.jpg)
已经配置了JAVA_HOME,执行java和javac都报错,java或者javac不是内部或外部命令,把PATH里面的java删除相关配置,重新配置。
![](https://img.bwb5.com/d/file/p/2022080906002825993/2022080906002825994.jpg)
报Cannot start compiler,这通常是手滑把out删除目录
![](https://img.bwb5.com/d/file/p/2022080906002825999/2022080906002826000.jpg)
点击idea右上角有一个带有三个蓝色方块图标的文件,如图:
![](https://img.bwb5.com/d/file/p/2022080906002826005/2022080906002826006.jpg)
进入到Project Structure然后找到界面Project,然后看右边的窗户,你会发现下一个框中的文件路径是空的
![](https://img.bwb5.com/d/file/p/2022080906002826017/2022080906002826018.jpg)
可以重新补齐,如图:
![](https://img.bwb5.com/d/file/p/2022080906003026137/2022080906003026138.jpg)
然后点一下【OK】保存,再操作一般都可以。
![](https://img.bwb5.com/d/file/p/2022080906003026143/2022080906003026144.jpg)
如果不存在out文件夹,直接文件夹。
IDEA-02
JDK未识别
![](https://img.bwb5.com/d/file/p/2022080906003026147/2022080906003026148.jpg)
手工添加SDK,也就是JDK
![](https://img.bwb5.com/d/file/p/2022080906003026185/2022080906003026186.jpg)
找到JDK的安装路径
![](https://img.bwb5.com/d/file/p/2022080906003126191/2022080906003126192.jpg)
JDK识别出来。
![](https://img.bwb5.com/d/file/p/2022080906003126197/2022080906003126198.jpg)
IDEA-03
报告无效源发行版
![](https://img.bwb5.com/d/file/p/2022080906003126213/2022080906003126214.jpg)
找到右上角有三个蓝色方块的文件夹,因为使用了JDK1.8,所以language要修改为8
![](https://img.bwb5.com/d/file/p/2022080906003126217/2022080906003126218.jpg)
代码和环境都没有问题,但类无法报告或加载。
![](https://img.bwb5.com/d/file/p/2022080906003326279/2022080906003326280.jpg)
先关闭项目,
![](https://img.bwb5.com/d/file/p/2022080906003326283/2022080906003326284.jpg)
然后删除项目录中的项目录.idea文件夹,再次打开项目
![](https://img.bwb5.com/d/file/p/2022080906003326289/2022080906003326290.jpg)
然后修理
![](https://img.bwb5.com/d/file/p/2022080906003326293/2022080906003326294.jpg)
![](https://img.bwb5.com/d/file/p/2022080906003326295/2022080906003326296.jpg)
![](https://img.bwb5.com/d/file/p/2022080906003426299/2022080906003426300.jpg)
![](https://img.bwb5.com/d/file/p/2022080906003426301/2022080906003426302.jpg)
![](https://img.bwb5.com/d/file/p/2022080906003426307/2022080906003426308.jpg)
![](https://img.bwb5.com/d/file/p/2022080906003426311/2022080906003426312.jpg)
![](https://img.bwb5.com/d/file/p/2022080906003426315/2022080906003426316.jpg)
![](https://img.bwb5.com/d/file/p/2022080906003526335/2022080906003526336.jpg)
![](https://img.bwb5.com/d/file/p/2022080906003526337/2022080906003526338.jpg)
![](https://img.bwb5.com/d/file/p/2022080906003526347/2022080906003526348.jpg)
![](https://img.bwb5.com/d/file/p/2022080906003626353/2022080906003626354.jpg)
![](https://img.bwb5.com/d/file/p/2022080906003626359/2022080906003626360.jpg)
![](https://img.bwb5.com/d/file/p/2022080906003626365/2022080906003626366.jpg)
![](https://img.bwb5.com/d/file/p/2022080906003726371/2022080906003726372.jpg)
![](https://img.bwb5.com/d/file/p/2022080906003726373/2022080906003726374.jpg)
![](https://img.bwb5.com/d/file/p/2022080906003726375/2022080906003726376.jpg)
支持修复完了。