简体   繁体   English

线程“主”中的异常java.lang.ClassNotFoundException?

[英]Exception in thread “main” java.lang.ClassNotFoundException?

I cloned my project from GitHub and now I am not able to run my project. 我从GitHub克隆了项目,但现在无法运行我的项目。

package edu.test.algorithm;

import edu.test.algorithm.Global;

public class Main {

public static void main(String[] args) {
    Global global= new Global();
    global.runGlobal("-----url");
  }
}

I am getting this error: 我收到此错误:

Exception in thread "main" java.lang.ClassNotFoundException: edu.test.algorithm.Global.Main
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)

Any idea what's causing this error? 知道是什么原因导致此错误吗?

EDIT 编辑

I checked this question Intellij suddenly throwing ClassNotFoundException before i posted here and it doesn't give me any solution.. Why marking my question as duplicate since that one isn't solving my problem? 我在此发布之前检查了Intellij突然抛出ClassNotFoundException的问题,但它没有给我任何解决方案。为什么将我的问题标记为重复,因为那不能解决我的问题?

Maybe your Ide is wrong run/debug configuration 也许您的Ide是错误的运行/调试配置

Main -> Edit Configuration 主菜单->编辑配置

enter image description here 在此处输入图片说明

Check your IDE run configurations and Class 检查您的IDE运行配置和类

https://www.jetbrains.com/help/idea/2016.2/creating-and-editing-run-debug-configurations.html https://www.jetbrains.com/help/idea/2016.2/creating-and-editing-run-debug-configurations.html

The exception message hints that you have used the wrong class name when launching the program. 异常消息提示您在启动程序时使用了错误的类名。

You are (presumably) using edu.test.algorithm.Global.Main as the class name. 您(大概)使用edu.test.algorithm.Global.Main作为类名。 However you have actually declared Main in the package edu.test.algorithm which means that its full classname is actually edu.test.algorithm.Main . 但是,您实际上已经在edu.test.algorithm包中声明了Main ,这意味着其完整类名实际上是edu.test.algorithm.Main

If you didn't do this explicitly, it is possible 1 that you changed the Main classes package and neglected to change (or remake) the launcher config. 如果您未明确执行此操作,则可能是1更改了Main classes包,而忽略了更改(或重新制作)启动程序配置。


1 - I'm not familiar with Intellij ... but I know you can run into this kind of problem with Eclipse. 1-我不熟悉Intellij ...但是我知道您可以在Eclipse中遇到这种问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 线程“main”java.lang.ClassNotFoundException中的异常: - Exception in thread “main” java.lang.ClassNotFoundException: 线程“main”中的异常 java.lang.ClassNotFoundException,mapreduce - Exception in thread "main" java.lang.ClassNotFoundException, mapreduce Class.forName 中的线程“main”java.lang.ClassNotFoundException 中的异常 - Exception in thread "main" java.lang.ClassNotFoundException in Class.forName 线程“主”中的异常java.lang.ClassNotFoundException:TrackPlayer.MainTrack - Exception in thread “main” java.lang.ClassNotFoundException: TrackPlayer.MainTrack 线程“主”中的异常java.lang.ClassNotFoundException:MaxTemperature - Exception in thread “main” java.lang.ClassNotFoundException:MaxTemperature 线程“main”中的异常java.lang.ClassNotFoundException:WordCount - Exception in thread “main” java.lang.ClassNotFoundException: WordCount Docker 错误:线程“主”java.lang.ClassNotFoundException 中的异常 - Docker error: Exception in thread "main" java.lang.ClassNotFoundException 线程“主”中的异常java.lang.NoClassDefFoundError:MyFile原因:java.lang.ClassNotFoundException: - Exception in thread “main” java.lang.NoClassDefFoundError: MyFile Caused by: java.lang.ClassNotFoundException: 线程“ main”中的异常java.lang.ClassNotFoundException:sample.Main-为什么? - Exception in thread “main” java.lang.ClassNotFoundException: sample.Main - why? Hadoop Java错误:线程“ main”中的异常java.lang.ClassNotFoundException:泰坦尼克号 - Hadoop Java Error : Exception in thread “main” java.lang.ClassNotFoundException: Titanic
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM