linux安装jdk笔记

dzwcom 2015-06-04

新机器安装maven:

sudo apt-get install maven2

安装maven2的时候,默认安装了openjdk

如果不希望openjdk, 而安装sunjdk 

卸载掉openjdk

sudo apt-get purge openjdk*

可以把其他服务器上的jdk拷贝过来

sudo scp /usr/lib/jvm/java-6-sun-1.6.0.26 caofy@目标机器:/tmp

sudp cp -r /tmp/java-6-sun-1.6.0.26 /usr/lib/jvm

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-6-sun-1.6.0.26/bin/java 300

sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-6-sun-1.6.0.26/bin/javac 300

sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/java-6-sun-1.6.0.26/bin/jar 300

sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/java-6-sun-1.6.0.26/bin/javah  300

sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/java-6-sun-1.6.0.26/bin/javap 300

然后:

sudo update-alternatives --config java

测试是否成功:

$ java version "1.6.0_26"

Java(TM) SE Runtime Environment (build 1.6.0_26-b03)

Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode) 

参考:http://www.cnblogs.com/plinx/archive/2013/06/01/3113106.html

相关推荐

citic / 0评论 2020-06-16