Instructions Set JAVA_HOME System-Wide

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

时间: 2024-10-12 19:51:24

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了. 后来,让同事帮我看.他没说啥,也没暴跳如雷,只是去搜一下“Android studio 配置jdk” https://zhidao.baidu.com/question/496702061644253324.html 然后 刚刚把开发环境换成android studio,还不熟悉,想把jdk和sdk的路径换

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 coupled to a system controller. An interconnect module, interconnects the main memory and sub-systems in accordance with interconnect control signals

Data analysis system

A data analysis system, particularly, a system capable of efficiently analyzing big data is provided. The data analysis system includes an analyst server, at least one data storage unit, a client terminal independent of the analyst server, and a cach

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 operating system running in the hypervised computer system. The operating system determines whether the page table request requires the hypervisor to process.

记一次在mac上配置Maven 的JAVA_HOME的惨痛经历

今天装好了了Maven3.3.3后,死活运行不了 CvdeMacBook-Pro:~ chenwei$ mvn Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0 这个错误明显是运行的jdk版本低于编译的jdk版本,但是本地的jdk已经装成1.8了,maven3.3.3

java的System.getProperty()方法能够获取的值

java.version Java 执行时环境版本号 java.vendor Java 执行时环境供应商 java.vendor.url Java 供应商的 URL java.home Java 安装文件夹 java.vm.specification.version Java 虚拟机规范版本号 java.vm.specification.vendor Java 虚拟机规范供应商 java.vm.specification.name Java 虚拟机规范名称 java.vm.version Jav

java的System.getProperty()方法可以获取的值

java.version Java 运行时环境版本 java.vendor Java 运行时环境供应商 java.vendor.url Java 供应商的 URL java.home Java 安装目录 java.vm.specification.version Java 虚拟机规范版本 java.vm.specification.vendor Java 虚拟机规范供应商 java.vm.specification.name Java 虚拟机规范名称 java.vm.version Java 虚

Mac OS X 下查看和设置JAVA_HOME

原文链接 : http://blog.csdn.net/done58/article/details/51138057 1, 查看Java版本 打开Mac电脑,查看JAVA版本,打开终端Terminal,通过命令行查看笔者的java版本:: [html] view plain copy bogon:~ donny$ java -version java version "1.7.0_71" Java(TM) SE Runtime Environment (build 1.7.0_71-

java的System.getProperty()值的方法可以得到

java.version Java 执行时环境版本号 java.vendor Java 执行时环境供应商 java.vendor.url Java 供应商的 URL java.home Java 安装文件夹 java.vm.specification.version Java 虚拟机规范版本号 java.vm.specification.vendor Java 虚拟机规范供应商 java.vm.specification.name Java 虚拟机规范名称 java.vm.version Jav