搜索 java ppa
//sudo apt-add-repository ppa:flexiondotorg/java
sudo apt-add-repository ppa:sun-java-community-team/sun-java6
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin
sudo apt-get install sun-java6-jdk
设置当前默认的java解释器和编译器: (如果没有安装多个java虚拟机的话可以跳过这一步。)
sudo update-alternatives --config java
update-alternatives - maintain symbolic links determining default commands
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export JRE_HOME=/usr/lib/jvm/java-6-sun/jreexport CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATHTesting:
java –version
Create HelloWorld.java ->
public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); }}
javac HelloWorld.java
java HelloWorld