首页 > 代码库 > linux下,手动切换jdk
linux下,手动切换jdk
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 modePress <enter> to keep the current choice[*], or type selection number:
3、验证
seven@ThinkPad:~/srcAndroid/src4.4.4_r1$ java -versionjava 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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。