1. Switch To Oracle JDK8

 Switch To Oracle JDK8
1.1 Switch Oracle JDK in the Unbuntu 14.04 Step1 : Download a .tar.gz from Oracle(here i will be using jdk-8u91-linux-x64.tar.gz) http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Step2 : Extract it to directory /usr/lib/jvm
After extract it and set the permission
$sudo chmod -R /usr/lib/jvm/jdk1..0_91/ Step3 : Update the new JAVA environment , run below command one by one sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_91/bin/java" sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_91/bin/javac" sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.8.0_91/bin/javaws" Step : Run below command to update the JAVA environment
sudo update-alternatives --config java root@icilubuntu-HP-Compaq--Pro-MT-PC:/usr/lib/jvm/oracle-jdk-6u35# sudo update-alternatives --config java
There are choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status
------------------------------------------------------------
* /usr/lib/jvm/java--openjdk-amd64/jre/bin/java auto mode
/usr/lib/jvm/java--openjdk-amd64/jre/bin/java manual mode
/usr/lib/jvm/jdk1..0_91/bin/java manual mode Press enter to keep the current choice[*], or type selection number: Select the number of new /usr/lib/jvm/jdk1..0_91/bin/java and press Enter . Now confirm that java command is the new installed one
Type: java -version
Should show:
java version "1.8.0_91" Java(TM) SE Runtime Environment (build 1.8.0_91-b14) Java HotSpot(TM) -Bit Server VM (build 25.91-b14, mixed mode) Step :sudo gedit /etc/profile 然后在其中加入如下的内容
. export JAVA_HOME=/usr/lib/jvm/jdk1..0_91
. export JRE_HOME=/usr/lib/jvm/jdk1..0_91/jre
. export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
. export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH 保存并退出,输入如下命令,使以上设置生效
. source /etc/profile Step : Set the Eclipse default JAVA environment Open Eclipse to menu Window-> Preferences-Installed JREs , set it to the new JDK path

Switch To Oracle JDK6

Switch To  Oracle JDK6

. Install the oracle JDK as below
Step1 : Create “oracle-jdk-6u35” under “usr/lib/jvm/”
Step2 : Put the jdk-6u35-linux-x64.bin to “/usr/lib/jvm/oracle-jdk-6u35” and install the JDK
Type : $/usr/lib/jvm/oracle-jdk-6u35# ./jdk-6u35-linux-x64.bin
* jdk-6u35-linux-x64.bin http://192.168.18.224:8888/svn/Work_Space/Prototype/Integration_Workspace/software_env/jdk-6u35-linux-x64.bin
. Set /etc/alternatives which ensure all the java related programs are using the
same one, if not, will get the peer not authenticated error as below ::, WARN [PortalImpl:] com.liferay.portal.kernel.exception.SystemException: org.jets3t.service.S3ServiceException: Request Error: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated Step1: copy /usr/lib/jvm/.java--openjdk.jinfo to /usr/lib/jvm/.oracle-jdk-6u35.jinfo
Type: cp .java--openjdk.jinfo .oracle-jdk-6u35.jinfo Step : Register new alternatives in update-alternatives mechanism. Type:
cat .oracle-jdk-6u35.jinfo | grep -E '^(hl|jre|jdk)' | awk '{print "/usr/bin/" $2 " " $2 " " $3 " 30 \n"}' | xargs -t -n4 sudo update-alternatives --verbose --install Step3 : Check if successful registered, type:
update-java-alternatives -l
Then should show:
oracle-jdk-6u35 /usr/lib/jvm/oracle-jdk-6u35 Step4 : Set chosen option , type:
sudo update-java-alternatives -s oracle-jdk-6u35
update-alternatives: error: no alternatives for mozilla-javaplugin.so <<ignore it>>
Now confirm that java command is the new installed one
Type: java -version
Should show:
java version "1.6.0_35"
Java(TM) SE Runtime Environment (build 1.6.0_35-b10)
Java HotSpot(TM) -Bit Server VM (build 20.10-b01, mixed mode) Step5 : Copy the certificates from openjdk directory to oracle sun directory
Type: ls -l /etc/alternatives/keytool
Should show: /etc/alternatives/keytool -> /usr/lib/jvm/oracle-jdk-6u35/jdk1..0_35/jre/bin/keytool Type: sudo cp /usr/lib/jvm/java--openjdk/jre/lib/security/jssecacerts /usr/lib/jvm/oracle-jdk-6u35/jdk1..0_35/jre/lib/security
sudo cp /usr/lib/jvm/java--openjdk/jre/lib/security/cacerts /usr/lib/jvm/oracle-jdk-6u35/jdk1..0_35/jre/lib/security Step6 : set JAVA_HOME in tomcat's startup script /etc/init.d/tomcat6
export JAVA_HOME=/usr/lib/jvm/oracle-jdk-6u35/jdk1..0_35

Ubuntu jdk 8 与 6 切换 (安装与配置)的更多相关文章

  1. Ubuntu 14.04 下 android studio 安装 和 配置【转】

    本文转载自:http://blog.csdn.net/xueshanfeihu0/article/details/52979717 Ubuntu 14.04 下 android studio 安装 和 ...

  2. Ubuntu 16.04下Java环境安装与配置

    首先下载linux下的安装包 登陆网址https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.h ...

  3. Ubuntu 16.04服务器 软件的安装及配置

    SSH的安装及配置 SSH分客户端openssh-client和openssh-server 如果你只是想登陆别的机器的SSH只需要安装openssh-client(ubuntu有默认安装,如果没有则 ...

  4. (四)Ubuntu 14.04 文件服务器--samba的安装和配置

    samba是Linux系统上的一种文件共享协议,可以实现Windows系统访问Linux系统上的共享资源,现在介绍一下如何在Ubuntu 14.04上安装和配置samba一. 一.更新源列表 打开&q ...

  5. Caffe + Ubuntu 15.04 + CUDA 7.0 安装以及配置

    作为小码农的我,昨天就在装这个东东了,主要参考第一篇博文,但是过程发现很多问题,经过反反复复,千锤百炼,终于柳暗花明,我把这个caffe给搞定了,是故,我发布出来,后之来者,欲将有感于斯文~ 本分分为 ...

  6. Window下JDK、Tomcat、eclipse安装与配置

    今天项目组开会,由于.Net平台的限制无法满足现有业务需求,项目计划从.Net平台转Java平台,采用Java+Spark+Hadoop,之前关于Java和Hadoop的书也买的有只是平时看的少,最近 ...

  7. ubuntu 14.04 (desktop amd 64) 安装和配置ROS Indigo

    安装ROS 配置Ubuntu的软件源 配置Ubuntu要求允许接受restricted.universe和multiverse的软件源,可以根据下面的链接配置: https://help.ubuntu ...

  8. Ubuntu 12.04下mysql的安装与配置

    转自:http://blog.csdn.net/ichsonx/article/details/9285935 准备  0. 获取 mysql-5.5.15-linux2.6-i686.tar.gz ...

  9. Tomcat与jdk在Linux上的安装与配置

    本人qq群也有许多的技术文档,希望可以为你提供一些帮助(非技术的勿加). QQ群:   281442983 (点击链接加入群:http://jq.qq.com/?_wv=1027&k=29Lo ...

随机推荐

  1. synchronized (lock) 买票demo 线程安全

    加锁防止多个线程执行同一段代码! /** http://blog.51cto.com/wyait/1916898 * @author * @since 11/10/2018 * 某电影院目前正在上映贺 ...

  2. (转)typedef和define的详细区别

    来源:http://developer.51cto.com/art/201104/256060.htm typedef是一种在计算机编程语言中用来声明自定义数据类型,配合各种原有数据类型来达到简化编程 ...

  3. Java JDK 版本的区别

    jdk6和jdk5相比的新特性有: 1.instrumentation 在 Java SE 6 里面,instrumentation 包被赋予了更强大的功能:启动后的 instrument.本地代码 ...

  4. MySQL--修改MySQL账号密码

    ##使用mysqladmin进行修改 mysqladmin -u username -h hostname password 'new password'; ##使用set命令进行修改 SET PAS ...

  5. day34 python学习 守护进程,线程,互斥锁,信号量,生产者消费者模型,

    六 守护线程 无论是进程还是线程,都遵循:守护xxx会等待主xxx运行完毕后被销毁 需要强调的是:运行完毕并非终止运行 #1.对主进程来说,运行完毕指的是主进程代码运行完毕 #2.对主线程来说,运行完 ...

  6. vulcanjs schemas&& collections

    一张参考图 说明 从上图我们可以方便的看出schmea 能做的事情 Generate a GraphQL equivalent of your schema to control your Graph ...

  7. ZooKeeper 知识点

    zookeeper 命令: 命令 说明 ./zkServer.sh start 启动ZooKeeper(终端执行) ./zkServer.sh stop 停止ZooKeeper(终端执行) ./zkC ...

  8. md5,base64,rsa

    MD5功能:    输入任意长度的信息,经过处理,输出为128位的信息(数字指纹):    不同的输入得到的不同的结果(唯一性):    根据128位的输出结果不可能反推出输入的信息(不可逆): 1. ...

  9. 数独求解程序 php版

    数独求解程序 php版 <?php class Sudoku { var $matrix; function __construct($arr = null) { if ($arr == nul ...

  10. centos6/7安装gitlab

    CentOS/RHEL 6/7安装gitlab新建 /etc/yum.repos.d/gitlab-ce.repo,内容为你的CentOS/RHEL版本:centos6 [gitlab-ce] nam ...