/** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Hello World!");
}
}
在eclipse下编译成test001.class运行良好, 可是当我用windows的cmd控制台下,输入java test001.class却总是 报错: E:\eclipse\workspace\test001\bin\test001>java test001.class Exception in thread "main" java.lang.NoClassDefFoundError: test001 (wrong name: test001/test001) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) 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: test001. Program will exit.