set JAVA_HOME in RHEL/CentOS
3.3. Install OpenJDK on Red Hat Enterprise Linux
OpenJDK is one of many Java Development Kits (JDKs) supported in Red Hat Enterprise Linux for use with JBoss enterprise products. This task shows you how to install OpenJDK in Red Hat Enterprise Linux, and how to configure your system to use it as the default JDK.
Note
You must meet the following conditions before continuing with this task:
- You must be running Red Hat Enterprise Linux 6. OpenJDK is not available or supported for Red Hat Enterprise Linux 5 at this time.
- The server running Red Hat Enterprise Linux 6 must be registered with RHN and subscribed to the base channel. Refer to the Package Management section of the Red Hat Enterprise Linux 6 Deployment Guide on https://access.redhat.com/knowledge/docs/ for more information about managing subscriptions and entitlements on Red Hat Enterprise Linux systems.
Install the OpenJDK RPM.
There are two different ways to install an RPM, depending on whether you have used a command-line interface (CLI) or a Graphical User Interface (GUI).From the CLI
After logging in with administrator access, run one of the following two commands:- OpenJDK 6
-
yum install java-1.6.0-openjdk-devel - OpenJDK 7
-
yum install java-1.7.0-openjdk-devel
From a GUI
- In Gnome, select Administration from the System menu, and click Add / Remove Software.
- Search for
openjdkand choose thejava-1.6.0-openjdk-develoption for OpenJDK 6 or thejava-1.7.0-openjdk-develoption for OpenJDK 7. - Click Apply to install the selected packages and dependencies.
- When prompted, enter the administrator password to install the packages.
Optional: Set the
JAVA_HOMEenvironment variable.Some applications such as Apache Maven and Apache Ant require you to set theJAVA_HOMEenvironment variable. If you need to do this, follow these steps.- Determine the correct value for
JAVA_HOME. Red Hat Enterprise Linux installs OpenJDK 1.6 into either/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/or/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/, depending on whether your system is a 32-bit or 64-bit architecture. TheJAVA_HOMEshould point to the directory containing abin/javaexecutable. - As the user who will use OpenJDK, open the shell configuration file. For the Bash shell, this file is
/home/.username/.bashrc - At the bottom of the file, type the following line, replacing the hypothetical path with the actual path to use on your own system:
export JAVA_HOME="/path/to/java/home" - Save the file, and log out of and back into your session.
Switch between different OpenJDK versions using the
alternativesutility.Red Hat Enterprise Linux includes a utility calledalternatives, which lets you change the default version for applications which allow multiple versions to be installed. OpenJDK is one such application.To use thealternativesutility, perform the following steps. Note that setting the environment variables overrides the behavior of thealternativescommand. For instance, if you use a script which manually sets$JAVA_HOMEand$JAVAvariables to a different JDK from the one specified by thealternativescommand, the environment variables will override the command.- Log in as the
rootuser, or prefix the commands below with thesudocommand. - The
alternativescommand is not installed by default, but may already be installed on your system. If not, install thealternativespackage by running the following command:yum install alternatives
- Issue the following command:
/usr/sbin/alternatives --config java
- Follow the prompts that follow to set the default version of OpenJDK.
OpenJDK is installed on your server and available for your use. If necessarily, the JAVA_HOMEenvironment variable has been specified as well. If necessary, the default OpenJDK for your system has been set using the alternatives utility.
Set JAVA_HOME
Ensure all users have their JAVA_HOME environment variable set to the correct value:
echo "export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk.x86_64" > /etc/profile.d/java_home.sh
set JAVA_HOME in RHEL/CentOS的更多相关文章
- (转)RHEL/CentOS 6.x使用EPEL6与remi的yum源安装MySQL 5.5.x
PS:如果既想获得 RHEL 的高质量.高性能.高可靠性,又需要方便易用(关键是免费)的软件包更新功能,那么 Fedora Project 推出的 EPEL(Extra Packages for En ...
- RHEL/CentOS 7最小化安装后需做的30件事情
导读 CentOS是一个工业标准的Linux发行版,是红帽企业版 Linux 的衍生版本.你安装完后马上就可以使用,但是为了更好地使用你的系统,你需要进行一些升级.安装新的软件包.配置特定服务和应用程 ...
- RHEL/CentOS/Fedora各种源(EPEL、Remi、RPMForge、RPMFusion)配置
最新文章:Virson’s Blog CentOS默认自带CentOS-Base.repo源,但官方源中去除了很多有版权争议的软件,而且安装的软件也不是最新的稳定版.Fedora自带的源中也找不到很多 ...
- How to install 64-bit Google Chrome 28+ on 64-bit RHEL/CentOS 6 or 7
How to install 64-bit Google Chrome 28+ on 64-bit RHEL/CentOS 6 or 7 The problem Google developers s ...
- Enable EPEL Repository for RHEL/CentOS 7.x/6.x/5.x
This howto guide shows you’ll how to enable EPEL repository under RHEL/CentOS 6/5 to install additio ...
- Google Chrome 55 Released – Install on RHEL/CentOS 7/6 and Fedora 25-20
Google Chrome is a freeware web browser developed by Google Inc. Google Chrome team proudly announce ...
- Linux Systemd——在RHEL/CentOS 7中启动/停止/重启服务
RHEL/CentOS 7.0中一个最主要的改变,就是切换到了systemd.它用于替代红帽企业版Linux前任版本中的SysV和Upstart,对系统和服务进行管理.systemd兼容SysV和Li ...
- RHEL/CentOS 6.x 系统服务详解
PS:RHEL/CentOS 6.x的系统服务比5.x系列的要多了很多新面孔,估计很多童鞋不甚理解,网上这方面资料也很少.理解这个对运维人员是必要的,因为开启不必要的服务越 多,系统就相对越不安全.不 ...
- Install TightVNC Server in RHEL/CentOS and Fedora to Access Remote Desktops
Virtual Networking Computing (VNC) is a Kind of remote sharing system that makes it possible to take ...
随机推荐
- [TD Cup 2014] TDL的YC牌 & TDL的幼儿园
TDL的YC牌 传说中的置换群?反正不懂.我的思路竟然是对的,可是为何只有20分? (1)尼玛每行数据输出后回车不打! (2)写gcd函数脑残把a mod b写成a-b,大大减慢速度… (3)看标程才 ...
- juery常用
1input解除焦点时触发操作 同时给另一个元素赋值 $(document).ready(function(){ $("input[name='url']").change(fun ...
- 性能测试报告的指标选择、数据选择和分析的参考【以Apache AB test为例】
前几天尝试用loadrunner初试了一下性能测试,对于如何选择数据.生成数据后如何分析很是迷惑,刚刚翻看一篇网友的博客,很有条理,特此记录一下,以供参考 转自: http://liriguang.i ...
- iOS 模拟器上录制Demo视频
在App审核中会让用户上传一段简易的视频,那么如何制作改视频呢? 今天无意中在Cocochina 中看到 说利用QuickTime来制作,而QuickTime是操作系统自带的. 哦 My,God ! ...
- pads
1安装和破解,这个网上很多资料,破解的时候比较麻烦一点,注意安装环境. 2无模命令 (pads特点就是快捷键操作) 参考http://www.cnblogs.com/asus119/archive/2 ...
- eclipse新建安卓项目点击finish后窗口无法关闭
eclipse新建安卓项目点击finish后窗口不会自动关闭,而且工程会有很多报错: 如图,这个页面点击finish一直无法关闭,后来试了试,才发现是因为新建项目的第一个页面的sdk版本的问题: 这里 ...
- MVC 3.0 Tree
页面分左右两部分,左边是一个导航树,右边是局部页,点击树节点,异步刷新右边的内容.加颜色部分是知识点. @using VideoWeb.Models@model VideoWeb.Models.Cat ...
- hibernate内部测试题(附赠答案)
一.选择题(共25题,每题2.5分,选择一项或多项,漏选错选不得分) 1.在Hibernate中,以下关于主键生成器说法错误的是( ). A.increment可以用于类型为long.short或by ...
- Oracle数据库习题
以下习题都已Oracle数据库中默认表为主体 1.列出至少有一个员工的所有部门. SELECT DISTINCT D.DNAME FROM EMP E,DEPT D WHERE E.DEPTNO=D. ...
- HTML结构文档中那些基础又重要又容易被忽略的事?
HTML结构文档中那些基础又重要又容易被忽略的事? 大部分的人,总是会做出这样下意识地判断:简单就是不重要,容易就可以直接忽略掉!其实不然,简有精髓,基石必重,岂能略而不顾!HTML结构文档的编写,可 ...