Topic: 为什么会出现Exception in thread "main" java.long.NoclassDefFoundError:Test

  Print this page

1.为什么会出现Exception in thread "main" java.long.NoclassDefFoundError:Test Copy to clipboard
Posted by: prince1234
Posted on: 2006-05-31 11:25

class Test
{
public static void main(String [] args)
{
System.out.println("My first Java program");
}
}
在doc下用javac Test.java然后运行java Test。
为什么会出现Exception in thread "main" java.long.NoclassDefFoundError:Test

请前辈们指点下

2.Re:为什么会出现Exception in thread "main" java.long.NoclassDefFoundError:Test [Re: prince1234] Copy to clipboard
Posted by: why
Posted on: 2006-05-31 11:40

It's java.lang.NoClassDefFoundError
Do a search on thsi board first, usually adding . to the CLASSPATH would help, i.e.
> set CLASSPATH=.
or
> java -cp . Test

Otherwise, please show us the results of the following:

> echo %JAVA_HOME%
> echo %PATH%
> echo %CLASSPATH%
> rem X is the drive letter where the java source is
> X:
> rem YourFolder is the folder where the java source is
> cd doc
> dir
> rem YourClassName is the class name
> javac Test.java
> java Test

3.Re:为什么会出现Exception in thread "main" java.long.NoclassDefFoundError:Test [Re: prince1234] Copy to clipboard
Posted by: prince1234
Posted on: 2006-05-31 11:50

打扰了。找到问题
原来是classpath的问题


   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