我不知道该怎么办! (java.lang.NoClassDefFoundError :)

时间:2014-06-26 02:30:06

标签: java compiler-errors

我的申请给我一个错误,我不知道如何解决! 我使用的是Netbeans 8.0。

错误:

Exception in thread "main" java.lang.NoClassDefFoundError: autenticacao/Logon
at bolaofuleco.BolaoFuleco.main(BolaoFuleco.java:23)
Caused by: java.lang.ClassNotFoundException: autenticacao.Logon
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 1 more
Java Result: 1

类: 负责人:

package bolaofuleco;

import autenticacao.Logon;
import javax.swing.JFrame;

public class BolaoFuleco {
    public static void main(String[] args) {
        Logon login;
        login = new Logon(new JFrame(), true);
    }

}

当我使用选项clean和Netbeans的构建出现时:

ant -f C:\\Users\\CaioCezar\\Documents\\NetBeansProjects\\BolaoFuleco -Dnb.internal.action.name=rebuild clean jar
init:
deps-clean:
Updating property file: C:\Users\CaioCezar\Documents\NetBeansProjects\BolaoFuleco\build\built-clean.properties
Deleting directory C:\Users\CaioCezar\Documents\NetBeansProjects\BolaoFuleco\build
clean:
init:
deps-jar:
Created dir: C:\Users\CaioCezar\Documents\NetBeansProjects\BolaoFuleco\build
Updating property file: C:\Users\CaioCezar\Documents\NetBeansProjects\BolaoFuleco\build\built-jar.properties
Created dir: C:\Users\CaioCezar\Documents\NetBeansProjects\BolaoFuleco\build\classes
Created dir: C:\Users\CaioCezar\Documents\NetBeansProjects\BolaoFuleco\build\empty
Created dir: C:\Users\CaioCezar\Documents\NetBeansProjects\BolaoFuleco\build\generated-sources\ap-source-output
Compiling 17 source files to C:\Users\CaioCezar\Documents\NetBeansProjects\BolaoFuleco\build\classes
C:\Users\CaioCezar\Documents\NetBeansProjects\BolaoFuleco\src\autenticacao\Logon.java:207: error: cannot find symbol
        if(Usuario != null){
  symbol:   variable Usuario
  location: class Logon
1 error
C:\Users\CaioCezar\Documents\NetBeansProjects\BolaoFuleco\nbproject\build-impl.xml:923: The following error occurred while executing this line:
C:\Users\CaioCezar\Documents\NetBeansProjects\BolaoFuleco\nbproject\build-impl.xml:263: Compile failed; see the compiler error output for details.

1 个答案:

答案 0 :(得分:2)

您的Logon课程未编译,

  

C:\用户\ CaioCezar \文件\的NetBeansProjects \ BolaoFuleco \ SRC \ autenticacao \ Logon.java:207:   错误:找不到符号if(Usuario!= null){symbol:variable Usuario location:class Logon

打开" src \ autenticacao \ Logon.java"你需要在那里修复编译器错误(在第207行)。据推测,对于Usuario != null检查,usuario != null应为if(假设它是一个字段,并遵循Java命名约定)。