今天试一下命令行里写代码吧,用管开发工具里,现在练习一下命令行里开发,可是出现错误:[code=java]package xg.myc;
public class Demo02{
public static void main(String[] args){
System.out.println("Demo02");
}
}[/code]F:\java\xg\myc>java Demo02
Exception in thread "main" java.lang.NoClassDefFoundError: Demo02 (wrong name: xg/myc/Demo02)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: Demo02. Program will exit.
加不加package xg.myc;javac没问题,但是加上package xg.myc;后运行出现以上错误???????
晕了 |