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. 【转】Python判断字符串是否为字母或者数字

    str_1 = " str_2 = "Abc" str_3 = "123Abc" #用isdigit函数判断是否数字 print(str_1.isdi ...

  2. 2018-2019-2 20165212《网络对抗技术》Exp1 PC平台逆向破解

    2018-2019-2 20165212<网络对抗技术>Exp1  缓冲区溢出实验 实验点1:逆向及Bof基础实践 实践任务 用一个pwn1文件. 该程序正常执行流程是:main调用foo ...

  3. Chrome在Ubuntu中缺少依赖项,无法安装

    在Ubuntu 13.04中,安装chrome会报下面这个错误(不知是不是因为我没有更新的原因:(  ): 也就是缺少名为libxss1的包. 解决办法,当然可以很简单的去找libxss1这个包下载, ...

  4. PHP安装sqlsrv和memcache扩展步骤

    做了两天的实验才终于摸清楚如何将PHP连接上sqlserver数据库,以及怎样通过修改virtualhost文件来重定向,因为走得弯路比较多所以很想分享一下这次的心路历程. 第一步:安装wamp等类似 ...

  5. Oracle 基础知识入门

    前记: 近来项目用到Oracle数据库,大学学了点,后面基本忘记得差不多了,虽然基本语法跟sql 差不多,但是oracle知识是非常多的. 这里简单说点基础知识,希望后面补上更多的关于ORacle知识 ...

  6. 使用 ASMCMD 工具管理ASM目录及文件

    ============================== -- 使用ASMCMD 工具管理ASM目录及文件 --============================== 在ASM实例中,所有的 ...

  7. wsdl详解

    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http:// ...

  8. hello word 应用程序的编写

    1.各类文件的书写 src中的文件: hello文件夹中的Makefile文件 # # Copyright (C) - OpenWrt.org # # This is free software, l ...

  9. 【appium】根据xpath定位元素

    1. 背景 本文尝试使用的试验对象是SDK自带的NotePad应用实例,假设已经有两个Notes分别是“note1”和“note2”添加到Notepad上面,我们要做的就是尝试用xpath的方法来定位 ...

  10. Fix Visual Studio 2013 Razor CSHTML Intellisense in Class Library or Console Application

    https://mhusseini.wordpress.com/2015/02/05/fix-visual-studio-2013-razor-cshtml-intellisense-in-class ...