Topic: 大家来帮帮忙吧! (java.lang.NoClassDefFoundError)

  Print this page

1.大家来帮帮忙吧! (java.lang.NoClassDefFoundError) Copy to clipboard
Posted by: wpr321
Posted on: 2003-10-02 23:26

今天用JSDK编译程序的时候能通过,但执行
“java Buttons"(button是编译后生成的class文件)的时候出现一下错误
“F:\>javac Buttons.java

F:\>java Buttons
Exception in thread "main" java.lang.NoClassDefFoundError: Buttons (wrong
myprojects/button/Buttons)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.j
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
"
环境变量已经设计好了,在文件头加了"import java.lang.*"还是有一样的错误
请大家帮帮忙解决吧

2.Re:大家来帮帮忙吧! [Re: wpr321] Copy to clipboard
Posted by: taogang
Posted on: 2003-10-02 23:44

be aware of which package the classes belongs to.

3.Re:大家来帮帮忙吧! [Re: wpr321] Copy to clipboard
Posted by: yamakasy
Posted on: 2003-10-03 01:45

CLASSPATH中应该添加上当前目录,比如
CLASSPATH=.;%JAVA_HOME%\lib\tools.jar

4.Re:大家来帮帮忙吧! (java.lang.NoClassDefFoundError) [Re: wpr321] Copy to clipboard
Posted by: hohaischooldays
Posted on: 2003-10-08 18:36

wpr321 wrote:
环境变量已经设计好了,在文件头加了"import java.lang.*"还是有一样的错误
请大家帮帮忙解决吧


"import java.lang.*"加不加是没有区别的,是默认的嘛,只是路径没设置好,导致找不到包。

5.Re:大家来帮帮忙吧! (java.lang.NoClassDefFoundError) [Re: hohaischooldays] Copy to clipboard
Posted by: helloworld
Posted on: 2003-10-08 18:43

not found , not found ,not found

6.Re:大家来帮帮忙吧! (java.lang.NoClassDefFoundError) [Re: hohaischooldays] Copy to clipboard
Posted by: heaven
Posted on: 2003-10-08 20:15

你从哪里抄的例子?是不是Buttons.java本来就没有main方法呀?
反正我是没见过直接运行生成button的代码


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923