在Eclipse里面设置jdk路径(这个不细说,不会自己搜)。 详细位置搜索ubuntu系统jdk安装的默认路径。 或者按照如下方法,手动查找(机器不同可能结果也不一样,但思路都是一样的): which javac 返回/usr/bin/javac file /usr/bin/javac 返回/usr/bin/javac: symbolic link to `/etc/alternatives/javac' 然后file /etc/alternatives/javac 返回/etc/alternatives/javac: symbolic link to `/usr/lib/jvm/java-6-sun/bin/javac' 然后file /usr/lib/jvm/java-6-sun/bin/javac 返回/usr/lib/jvm/java-6-sun/bin/javac: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped 到此为止,说明路径是/usr/lib/jvm/java-6-sun/bin/,在Eclipse里面设置即可。