Install Java JDK 7 on Ubuntu 12.04

This package provides Oracle Java JDK 7 (which includes JRE, the Java browser plugin and JavaFX). However, you can’t only install Oracle JRE – the PPA only provides the full Oracle JDK7 package.

  1. To add our PPA and install the latest Oracle Java (JDK) 7 in Ubuntu, use the commands below: #sudo add-apt-repository ppa:webupd8team/java #sudo apt-get update && sudo apt-get install oracle-jdk7-installer
  2. After the installation you have enable the jdk: #update-alternatives –display java
  3. Check if Ubuntu uses Java JDK 7 #java -version If all went right the answer should be something like this: java version “1.7.0_07″ Java(TM) SE Runtime Environment (build 1.7.0_07-b10) Java HotSpot(TM) Server VM (build 23.3-b01, mixed mode)
  4. Check what compiler is used: #javac -version The correct answer should be like this: javac 1.7.0_07
  5. Adding JAVA_HOME to environment Edit /etc/environment and add JAVA_HOME=/usr/lib/jvm/java-7-oracle to the end of the file. First open a Terminal (Applications → Accessories → Terminal), then enter: #sudo gedit /etc/environment Append to the end of the file: JAVA_HOME=/usr/lib/jvm/java-7-oracle
  6. Removing Oracle JDK 7 If you don’t want to use Oracle Java (JDK) 7 anymore and want to go back to OpenJDK, all you have to do is remove the Oracle JDK7 Installer and the previous Java (OpenJDK, etc.) version will be used: #sudo apt-get remove oracle-jdk7-installer

转载于:https://my.oschina.net/lujuyi/blog/126156

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值