java编程HELLOWORLD问题
publicclassHelloWorldApp{publicstaticvoidmain(Stringargs[]){System.out.println("Hello...
public class HelloWorldApp{
public static void main(String args[]){
System.out.println("Hello World!");
}
}
javac helloworldapp.java
可以正常编译
生成
helloworldapp.class
可是运行
java helloworldapp
出现错误
Exception in thread "main" java.lang.NoClassDefFoundError: helloworldapp (wrong
name: HelloWorldApp)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
C:\flykeying>java helloworldapp.class
Exception in thread "main" java.lang.NoClassDefFoundError: helloworldapp/class
初学者永远感谢老前辈! 展开
public static void main(String args[]){
System.out.println("Hello World!");
}
}
javac helloworldapp.java
可以正常编译
生成
helloworldapp.class
可是运行
java helloworldapp
出现错误
Exception in thread "main" java.lang.NoClassDefFoundError: helloworldapp (wrong
name: HelloWorldApp)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
C:\flykeying>java helloworldapp.class
Exception in thread "main" java.lang.NoClassDefFoundError: helloworldapp/class
初学者永远感谢老前辈! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询