Instructions

  1. 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

    • Sponsored Links

    • 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.

Read more : http://www.ehow.com/how_8424526_set-java-home-centos.html

Instructions Set JAVA_HOME System-Wide的更多相关文章

  1. 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了. 后来,让 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. Data analysis system

    A data analysis system, particularly, a system capable of efficiently analyzing big data is provided ...

  6. Java System.getProperty()方法获取系统信息

    用 System.getProperty()方法能获取到的系统信息: java.version Java 运行时环境版本 java.vendor Java 运行时环境供应商 java.vendor.u ...

  7. 疯狂java笔记(五) - 系统交互、System、Runtime、Date类

    一.程序与用户交互(Java的入口方法-main方法): 运行Java程序时,都必须提供一个main方法入口:public static void main(String[] args){} publ ...

  8. Mac OS 上设置 JAVA_HOME

    Mac OS 上设置 JAVA_HOME 原文链接:http://han.guokai.blog.163.com/blog/static/136718271201301183938165/ 由于需要, ...

  9. Android Capture Android System Audio

    项目需要获取播放视频的实时音量值,最简捷的方法是监听音频输出端,取得音频输出流,再进行转换. 调查时,首先找到这篇博客: http://blog.csdn.net/jinzhuojun/article ...

随机推荐

  1. [Javascript] Object.freeze() vs Object.seal()

    let person = { firstName: "Zhentian", lastName: "Wan" }; /*Object.freeze() makes ...

  2. PHP获取IP所在地区(转)

    1.获取IP地址的API新浪的IP地址查询接口:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js新浪多地域测试方法:http:/ ...

  3. careercup-递归和动态规划 9.9

    9.9 设计一种算法,打印八皇后在8*8棋盘上的各种摆法,其中每个皇后都不同行.不同列,也不在对角线上.这里的“对角线”指的是所有的对角线,不只是平分整个棋盘的那两条对角线. 类似leetcode:N ...

  4. Android开发之从网络URL上下载JSON数据

    网络下载拉取数据中,json数据是一种格式化的xml数据,非常轻量方便,效率高,体验好等优点,下面就android中如何从给定的url下载json数据给予解析: 主要使用http请求方法,并用到Htt ...

  5. bit,byte,char,string区别与基本类型认识

    bit.byte.位.字节.汉字的关系 1 bit     = 1  二进制数据        1 byte  = 8  bit        1 字母 = 1  byte = 8 bit       ...

  6. GCC安装

    1.apt-get install gcc2.apt-get install make3.apt-get install gdb apt-get install build-essential  这个 ...

  7. Redhat YUM U盘源配置

    Redhat YUM U盘源配置 1)在U盘创建目录 #mkdir /yum/Server 并从光盘Server.Packages 目录的所有文件拷贝到/yum/Server 2)安装 creater ...

  8. Orcle11g用户密码恢复

    1.当安装Orcle11g后,很久不用,忘记了用户名和密码.可以通过以下方法重置: 如上图及重置用户sys,system密码为123

  9. Redis操作字符串工具类封装,Redis工具类封装

    Redis操作字符串工具类封装,Redis工具类封装 >>>>>>>>>>>>>>>>>>& ...

  10. /etc/resolv.conf文件详解

    大家好,今天51开源给大家介绍一个在配置文件,那就是/etc/resolv.conf.很多网友对此文件的用处不太了解.其实并不复杂,它是DNS客户机配置文件,用于设置DNS服务器的IP地址及DNS域名 ...