ClassNotFoundException但在同一文件夹中的类

时间:2014-01-17 18:50:25

标签: java eclipse classnotfoundexception

我真的不明白。我刚刚创建了一个更简单的不可能的java项目。只有两个类,在同一个文件夹中。这是一个在Eclipse上没有花哨配置的常规项目。

主要课程:

public class Main {
    public static void main(String[] argv){
        MyClass var;
        try{
            var = new MyClass(); //throws classNotFoundException
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}

另一堂课:

public class MyClass{
    public MyClass(){
    }
}

首先,classNotFoundException(在这个证明中,不太可能。除此之外,try / catch块没有捕获任何东西。我仍然使用eclipse调试工具获得了stackTrace:

Main (1) [Java Application] 
    Main at localhost:52311 
        Thread [main] (Suspended)   
            owns: Object  (id=27)   
            owns: Object  (id=28)   
            ClassNotFoundException(Throwable).<init>(String, Throwable) line: 286   
            ClassNotFoundException(Exception).<init>(String, Throwable) line: not available 
            ClassNotFoundException(ReflectiveOperationException).<init>(String, Throwable) line: not available  
            ClassNotFoundException.<init>(String) line: not available   
            URLClassLoader$1.run() line: not available  
            URLClassLoader$1.run() line: not available  
            AccessController.doPrivileged(PrivilegedExceptionAction<T>, AccessControlContext) line: not available [native method]   
            Launcher$ExtClassLoader(URLClassLoader).findClass(String) line: not available   
            Launcher$ExtClassLoader(ClassLoader).loadClass(String, boolean) line: not available 
            Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: not available 
            Launcher$AppClassLoader.loadClass(String, boolean) line: not available  
            Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not available  
            Main.main(String[]) line: 9 

我试图清理项目并重新启动eclipse,但它没有帮助。两天前一切正常,我没有改变任何事情。发生了什么事?

0 个答案:

没有答案