[wenwen@ht ~]$ ll
总用量 32
lrwxrwxrwx 1 wenwen wenwen 45 7月 17 17:34 android -> ./workspace/popcap/osframework/source/android
drwx------ 4 wenwen wenwen 4096 7月 22 19:31 Downloads
-rwxrwxr-x 1 wenwen wenwen 85 6月 4 20:32 java.sh~
drwxrwxr-x 4 wenwen wenwen 4096 6月 30 10:26 mystudy
-rw-rw-r-- 1 wenwen wenwen 1695 7月 23 11:18 one.class
-rw-rw-r-- 1 wenwen wenwen 1481 7月 23 11:18 one.java
drwxrwxr-x 7 wenwen wenwen 4096 7月 4 18:16 tools
drwxrwxr-x 10 wenwen wenwen 4096 7月 22 12:25 workspace
drwxr-xr-x 2 wenwen wenwen 4096 7月 17 16:11 桌面
[wenwen@ht ~]$ javac one.java
[wenwen@ht ~]$ java one
Exception in thread "main" java.lang.NoClassDefFoundError: one (wrong name: dd/one)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: one. Program will exit.
[wenwen@ht ~]$
------解决方案--------------------
java dd.one
或者去除掉package
------解决方案--------------------
到dd 目录外面
javac dd/one.java
java dd.one