当前位置: 技术问答>java相关
菜鸟的题,很多分呀一定给。
来源: 互联网 发布时间:2014-12-23
本文导语: 程序如下 public class hello { public static void main(String argv[]) {for (int i=1;ijava hello.class that is test. Exception in thread "main" java.lang.NoClassDefFoundError: hello/class 这是什么意思,为什么? | java hello ...
程序如下
public class hello
{ public static void main(String argv[])
{for (int i=1;ijava hello.class that is test.
Exception in thread "main" java.lang.NoClassDefFoundError: hello/class
这是什么意思,为什么?
public class hello
{ public static void main(String argv[])
{for (int i=1;ijava hello.class that is test.
Exception in thread "main" java.lang.NoClassDefFoundError: hello/class
这是什么意思,为什么?
|
java hello 就行了,不用加.class
|
首先应该编译:
C:jdk1.2bin>javac hello.java
然后执行:
C:jdk1.2bin>java hello
C:jdk1.2bin>javac hello.java
然后执行:
C:jdk1.2bin>java hello
|
请看http://web2.java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html
我摘一段
Error Explanation
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp
If you receive this error, java cannot find your bytecode file, HelloWorldApp.class.
One of the places java tries to find your bytecode file is your current directory. So, if your bytecode file is in C:java, you should change your current directory to that. To change your directory, type the following command at the prompt and press Enter:
cd c:java
The prompt should change to C:java>. If you enter dir at the prompt, you should see your .java and .class files. Now enter java HelloWorldApp again.
If you still have problems, you might have to change your CLASSPATH variable. To see if this is necessary, try "clobbering" the classpath with the following command:
set CLASSPATH=
Now enter java HelloWorldApp again. If the program works now, you'll have to change your CLASSPATH variable. For more information, consult the section Check the CLASSPATH Variable in the installation instructions.
我摘一段
Error Explanation
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp
If you receive this error, java cannot find your bytecode file, HelloWorldApp.class.
One of the places java tries to find your bytecode file is your current directory. So, if your bytecode file is in C:java, you should change your current directory to that. To change your directory, type the following command at the prompt and press Enter:
cd c:java
The prompt should change to C:java>. If you enter dir at the prompt, you should see your .java and .class files. Now enter java HelloWorldApp again.
If you still have problems, you might have to change your CLASSPATH variable. To see if this is necessary, try "clobbering" the classpath with the following command:
set CLASSPATH=
Now enter java HelloWorldApp again. If the program works now, you'll have to change your CLASSPATH variable. For more information, consult the section Check the CLASSPATH Variable in the installation instructions.
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。