本文介绍了主线程中的Java异常-ClassNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Eclipse中的另一个系统库.有一次,图书馆以某种方式被删除了,而日食显示了一个红色的!".在项目文件夹图标旁边.我重新导入了库,但是仍然有红色的!".一旦我尝试编译并运行程序,它就会给我一个"ClassNotFoundException".

I'm working with another system library in Eclipse. One time, the library got somehow removed and eclipse showed a red "!" next to the projects folder icon. I re-imported the library, but there is still the red "!". Once I try to compile and run a program, it gives me a "ClassNotFoundException".

Exception in thread "main" java.lang.NoClassDefFoundError: MyClass
Caused by: java.lang.ClassNotFoundException: MyClass
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

我的java文件:

public class MyClass {

    public static void main(String[] args) {
        System.out.println("Test");
    }

}

我在源代码中看不到任何错误.发生了什么事?

I don't see any mistakes in my source code. What is going on?

推荐答案

将评论转换为答案

这篇关于主线程中的Java异常-ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 05:50
查看更多