码迷,mamicode.com
首页 > 系统相关 > 详细

linux下,手动切换jdk

时间:2017-06-16 16:46:48      阅读:270      评论:0      收藏:0      [点我收藏+]

标签:安装   conf   roi   ice   priority   runtime   str   providing   log   

1、首先将自定义的jdk目录安装到alternatives中

seven@ThinkPad:~/srcAndroid/src4.4.4_r1$ sudo update-alternatives --install /usr/bin/java java /home/seven/Documents/Android/jdk1.6.0_45/bin/java 700
seven@ThinkPad:~/srcAndroid/src4.4.4_r1$ sudo update-alternatives --install /usr/bin/javac javac /home/seven/Documents/Android/jdk1.6.0_45/bin/javac 700
seven@ThinkPad:~/srcAndroid/src4.4.4_r1$ sudo update-alternatives --install /usr/bin/jar jar /home/seven/Documents/Android/jdk1.6.0_45/bin/jar 700
seven@ThinkPad:~/srcAndroid/src4.4.4_r1$ sudo update-alternatives --install /usr/bin/javah javah /home/seven/Documents/Android/jdk1.6.0_45/bin/javah 700

2、选择

seven@ThinkPad:~/srcAndroid/src4.4.4_r1$ sudo update-alternatives --config java//可以是javac、javah、jar
[sudo] password for seven: 
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                                Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java       1071      auto mode
* 1            /home/seven/Documents/Android/jdk1.6.0_45/bin/java   700       manual mode
  2            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java       1071      manual mode

Press <enter> to keep the current choice[*], or type selection number:

3、验证

seven@ThinkPad:~/srcAndroid/src4.4.4_r1$ java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
seven@ThinkPad:~/srcAndroid/src4.4.4_r1$ 

 

linux下,手动切换jdk

标签:安装   conf   roi   ice   priority   runtime   str   providing   log   

原文地址:http://www.cnblogs.com/xunbu7/p/7027667.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!