Instructions Set JAVA_HOME System-Wide
Instructions
Set JAVA_HOME System-Wide
- 1
Start a root terminal session and then change directories to the /usr/lib/jvm folder. If you prefer, you can also log in to your system as root.
- 2
Display the folder's contents by typing the following command at the Bash shell prompt and then pressing "Enter:"
ls -l
The listing will show several symbolic links and a single folder that contains your Java package files. The Java folder installed on CentOS 7 systems may have a name resembling the following:
java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64
The full path to this folder, however, will be:
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64
- VPN For China:7 Days Free
Private VPN for Facebook & Youtube Unblock Websites : 7-Day Free Trial
- VPN For China:7 Days Free
- 3
Type the Bash shell Export
command that will set the $JAVA_HOME variable to the Java folder's full path and then press "Enter." Your command should resemble the following:export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64
If you type "echo $JAVA_HOME" (without the quotes) at the command line and press "Enter", the shell will display the JAVA_HOME path. The path change will be lost when you reboot, however, unless you add the change to the system profile located in the /etc folder.
- 4
Switch directories to /etc and then open the "profile" text file using an editor like Vi, Emacs or Nano. The profile text file contains system-wide bash shell commands, parameters and variable available to all users.
- 5
Scroll to a blank line near the bottom of the file, type the same Export command you entered at the shell prompt, save the file and then exit your editor. When you or another user logs in to a CentOS session, the JAVA_HOME variable will be set.
JAVA_HOME for Single Users
- 6
Launch the file manager and then navigate to the /usr/lib/jvm folder. The file manager should display the icons for one folder and several symbolic links.
- 7
Select the folder and then press "Ctrl-C" to copy it to the clipboard. One item the clipboard will contain is the full directory path to the Java folder.
- 8
As a normal, non-root user, launch Gedit and then open the ".bash_profile" text file located in your Home folder. Settings included in the .bash_profile are set every time you log in to your system.
- 9
Click a blank line near the bottom of the file and then press "Ctrl-V" to paste Java folder's full path. The pasted line should resemble the following:
file:///usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64
To put the path in a format you can use, however, delete the "file://" section. The result should resemble the following
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64
- 10
Add the Bash shell export command to this line that assigns the path to $JAVA_HOME, save your changes, and then exit Gedit. The final path command in your .bash_profile should resemble the following line:
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64
- 11
Log out of your CentOS session and then log back on set the $JAVA_HOME variable to Java's current location.
- 1
Read more : http://www.ehow.com/how_8424526_set-java-home-centos.html
Instructions Set JAVA_HOME System-Wide的更多相关文章
- Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable
编译的时候出现这个,我从svn download下来的代码,运行就报这个错. 当时我还无知的大吼,怎么可能没有配置java_home, 运行了java -version 都显示出来1.8了. 后来,让 ...
- yum安装jdk如何配置JAVA_HOME
安装Java环境 yum -y install java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64 查看安装后的配置 java -ver ...
- Operating system management of address-translation-related data structures and hardware lookasides
An approach is provided in a hypervised computer system where a page table request is at an operatin ...
- Parallelized coherent read and writeback transaction processing system for use in a packet switched cache coherent multiprocessor system
A multiprocessor computer system is provided having a multiplicity of sub-systems and a main memory ...
- Data analysis system
A data analysis system, particularly, a system capable of efficiently analyzing big data is provided ...
- Java System.getProperty()方法获取系统信息
用 System.getProperty()方法能获取到的系统信息: java.version Java 运行时环境版本 java.vendor Java 运行时环境供应商 java.vendor.u ...
- 疯狂java笔记(五) - 系统交互、System、Runtime、Date类
一.程序与用户交互(Java的入口方法-main方法): 运行Java程序时,都必须提供一个main方法入口:public static void main(String[] args){} publ ...
- Mac OS 上设置 JAVA_HOME
Mac OS 上设置 JAVA_HOME 原文链接:http://han.guokai.blog.163.com/blog/static/136718271201301183938165/ 由于需要, ...
- Android Capture Android System Audio
项目需要获取播放视频的实时音量值,最简捷的方法是监听音频输出端,取得音频输出流,再进行转换. 调查时,首先找到这篇博客: http://blog.csdn.net/jinzhuojun/article ...
随机推荐
- java14 处理流
二.处理流 .引用类型,保留数据+类型 序列化:将对象保存到文件或者字节数组中保存起来,叫序列化.输出流:ObjectOutputStream.writeObject(). 反序列化:从文件或者字节数 ...
- 【转】最新基于adt-bundle-windows-x86的android开发环境搭建
http://blog.csdn.net/wangqiuyun/article/details/8731240 某系统要配套做一个android客户端,来一次android开发环境快速搭建,系统Win ...
- 从源码角度深入理解Toast
Toast这个东西我们在开发中经常用到,使用也很简单,一行代码就能搞定: 1: Toast.makeText(", Toast.LENGTH_LONG).show(); 但是我们经常会遇到这 ...
- Android(java)学习笔记158:Java程序入口和Android的APK入口
1.Java程序的入口:static main()方法 public class welcome extends Activity { @Override public void onCreate(B ...
- hibernate----hibernate的基础设置
本次学习的内容是hibernate的基础设置 具体内容为: 一.准备工作 1.新建java工程 2.自动引入相关库(自动生成SessionFactory) 3.将数据库驱动拿进来 4.添加hibern ...
- wins和linux 系统不同编码格式导致的.py执行问题: bad interpreter: No such or file directory
我在win7上用IDLE编写了一个python文件(MyTopo.py),但是用putty传到VM中的ubuntu系统中,用 ./MyTopo方式执行. 显示: /bin/sh^M: bad inte ...
- IDispose(), Finalize()
C# using 用法: 1. 作为指令,用于为命名空间创建别名或导入其他命名空间中定义的类型.(见例1-1) 2. 作为语句,用于定义一个范围,在此范围的末尾将释放对象.(见例1-2) (例子1- ...
- hihocoder 第一周 最长回文字串
题目1 : 最长回文子串 时间限制:1000ms 单点时限:1000ms 内存限制:64MB 描述 小Hi和小Ho是一对好朋友,出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮助,在编程 ...
- xml、xhtml、html、dhtml的区别
1.XML 可扩展标记语言,标准通用标记语言的子集,是一种用于标记电子文件使其具有结构性的标记语言. 可扩展标记语言可以对文档和数据进行结构化处理,从而能够在部门.客户和供应商之间进行交换,实现动态内 ...
- Asp.Net 如何获取所有控件&如何获取指定类型的所有控件
一. Asp.Net Page页面中访问所有控件的属性为: Page.Controls 控件的结构是树结构. 二.获取指定类型所有控件实例: 1.递归方法定义: private void GetCon ...