主题:[原创]java运行结果的分析(急需寻求帮忙)
我是刚刚学习java的学生,就是最简单的HelloWorld程序。
public class HelloWorld{
public static void main(String args[]){
String str=args[0];
System.out.println("HelloWorld + "+ str +"!");
}
}
利用Dos得到的结果:
E:\>javac HelloWorld.java
E:\>java HelloWorld.java
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld/java
Caused by: java.lang.ClassNotFoundException: HelloWorld.java
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: HelloWorld.java. Program will exit.
非常感谢!!!
public class HelloWorld{
public static void main(String args[]){
String str=args[0];
System.out.println("HelloWorld + "+ str +"!");
}
}
利用Dos得到的结果:
E:\>javac HelloWorld.java
E:\>java HelloWorld.java
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld/java
Caused by: java.lang.ClassNotFoundException: HelloWorld.java
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: HelloWorld.java. Program will exit.
非常感谢!!!