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 ...
随机推荐
- 在 Vultr VPS 中 以 Debian 8 i386 (jessie) 为 操作系统 平台 手动 搭建 PPTP VPN 全过程
更新服务器并安装 PPTP 服务 apt-get update apt-get upgrade apt-get install pptpd 编辑 /etc/pptpd.conf 找到 #locali ...
- hdu 1057 (simulation, use sentinel to avoid boudary testing, use swap trick to avoid extra copy.) 分类: hdoj 2015-06-19 11:58 25人阅读 评论(0) 收藏
use sentinel to avoid boudary testing, use swap trick to avoid extra copy. original version #include ...
- android baseActivity
package newdemo.jeno.designdemo.activitynew; import android.os.Bundle;import android.support.annotat ...
- python leetcode 日记 --Contains Duplicate II --219
题目: Given an array of integers and an integer k, find out whether there are two distinct indices i a ...
- iOS 图片填充 UIImageView (contentMode)
掐指算下来做iOS开发也是有两年多的时间了,然后今天一个超级常用的控件让我颜面大跌,于是我准备把自己的丢人行径公之于众.如果您看到我这篇文章时和我一样,也是刚刚知道这项功能,那么您就当收获了一个... ...
- ”isEqual“ ”isEqalToString“ 和“==”三者区别
isEqual :首先判断的时对象类型是否 一样,然后再判断具体内容是否一致:如果类型不一样,return no: isEqualToString: 直接判断字符串内容,便捷更快速,但是前提确保比较的 ...
- Caffe 源碼閱讀(二) SyncedMemory.hpp
1. to_cpu 數據由現存同步到內存 2. to_gpu 數據由內存同步到顯存 3. cpu_str_ 內存指針 4. gpu_str_ 顯存指針 5. size_ 數據大小 6. own_cpu ...
- SEL方法选择器
在Objective-C中,选择器(selector)有两个意思. 一是指在代码中的方法的名称.二是指在编译是用于替换方法名称的唯一的标识符.编译后的选择器的为SEL类型.所有名称相同的方法拥有同一个 ...
- VNC-Server安装及配置
一.什么是VNC? VNC (Virtual Network Computer)是虚拟网络计算机的缩写.VNC 是一款优秀的远程控制工具软件,由著名的 AT&T 的欧洲研究实验室开发的.VNC ...
- vi编辑器使用相关
一.vi的使用 1.vi一共分为3种模式,分别是一般模式.编辑模式和命令行模式 2.一般模式:以vi打开一个文件就直接进入一般模式(也是默认的模式). 在这个模式下可以使用上下左右移动光标,还可以删除 ...