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. 【问题】解决在微信公众号里面网站无法访问:oops something went wrong:(

    最近在用一个第三方微信公众平台托管工具连接微信公众平台时,发现一个问题——在微信里面的官网网站链接没法在微信里面打开(无论是手机端还是PC端),会出现Oops! Something went wron ...

  2. 字符串哈希算法(以ELFHash详解)

    更多字符串哈希算法请参考:http://blog.csdn.net/AlburtHoffman/article/details/19641123 先来了解一下何为哈希: 哈希表是根据设定的哈希函数H( ...

  3. Python类之魔术方法

    一.什么是魔术方法? 在Python的方法,我们经常会遇见__XXX__(),这样的方法,我们一般称为"魔术方法",赶紧搬个小板凳,我们一起来看看魔术方法有啥神奇的地方,这些方法又 ...

  4. Python之进程(multiprocessing)

    一.multiprocessing模块简介——进程基于“threading”的接口 multiprocessing模块支持创建进程——使用threading模块相似的API.multiprocessi ...

  5. 剑指offer-青蛙变态跳台阶-全概率公式

  6. grandstack 基于graphql&&react&& apollo&& neo4j 的全栈开发工具

    grandstack是一个基于graphql&&react&& apollo&& neo4j 的全栈开发工具. 有篇关于graphql 的5个常见问题的 ...

  7. 容器、应用服务器和web服务器的区别

    什么是容器 servlet没main()方法.它们受控于另一个java应用,这个java应用称为容器(Container)Tomcat是这样的容器,Web服务器应用(Apache)得到一个指向serv ...

  8. PIG之 Hadoop 2.7.4 + pig-0.17.0 安装

    首先: 参考 http://blog.csdn.net/zhang123456456/article/details/77621487 搭建好hadoop集群. 然后,在master节点安装pig. ...

  9. MySQL索引分类和各自用途

    一. MySQL: 索引以B树格式保存 Memory存储引擎可以选择Hash或BTree索引,Hash索引只能用于=或<=>的等式比较. 1.普通索引:create index on Ta ...

  10. mysql联表查询

    2.1 内连接 select a.*,b.* FROM  a INNER join  b  ON a.id = b.id;  查出所有 或者 select a.*,b.* FROM a join b ...