Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Linux System Getting Started Tutorial: How to automatically set the JAVA_HOME environment variable on Linux     - AngularJS - Custom instructions (Programming)

- VMware Workstation virtual machine Ubuntu achieve shared with the host (Linux)

- SUSE Firewall Configuration (Linux)

- init level settings for Linux / etc / inittab file into six (restart) or does not support the level of solution (Linux)

- Android imageView in the Src and Background (Programming)

- Intruder tools Knark Analysis and Prevention Linux environment (Linux)

- Denyhosts prevent hackers using SSH scanning (Linux)

- expdp reported ORA-39181 Export Processing Method (Database)

- Puppet installation and testing (Server)

- Debian users to install FFmpeg 2.2.2 (Linux)

- Linux centos rm directory does not prompt (Linux)

- Oracle View index and use indexes Precautions (Database)

- How to build a container cluster (Server)

- VMware11 virtual machine Ubuntu14.10 system partition sda1 disk expansion (Linux)

- Windows environment Android Studio v1.0 Installation Guide (Linux)

- Swift string common method (Programming)

- Partition contrast manifestations under Windows and Linux (Linux)

- The difference between Linux su and sudo commands (Linux)

- How open source code libraries hosted on Github (Linux)

- Android application simulates the phone keypad (Programming)

 
         
  Linux System Getting Started Tutorial: How to automatically set the JAVA_HOME environment variable on Linux
     
  Add Date : 2018-11-21      
         
         
         
  Question: I need on my Linux machine to compile Java programs. For this reason I have installed JDK (Java Development Kit), and now I'm trying to set the JAVA_HOME environment variable to point to the installed JDK. About setting JAVA_HOME environment variable on Linux, what way is the most respected?

Many Java programs or Java-based integrated development environment (IDE) will need to set the JAVA_HOME environment variable. This variable should point to the Java Development Kit (JDK) or Java Runtime Environment (JRE) installation directory. JDK includes not only all the JRE provided also with additional binaries and library files (such as compilers, debuggers and JavaDoc documentation generator) for compiling Java programs. JDK is used to build Java programs, if you just run a Java program has already been built, a JRE alone is sufficient.

When you are trying to set JAVA_HOME environment variable, JAVA_HOME variable troublesome thing that needs to change in accordance with the following: (1) Have you installed the JDK or JRE; (2) which version you have installed; (3) you have installed It is Oracle JDK or Open JDK.

So whenever your development environment or the runtime environment changes (for example, JDK update version), you need to adjust the JAVA_HOME variable according to the actual situation, and this approach is tedious and inefficient.

The following export command can automatically set the JAVA_HOME environment variable for you, without regard to the above factors.

If you are installing the JRE:

export JAVA_HOME = $ (dirname $ (dirname $ (readlink -f $ (which java))))
If you installed JDK:

export JAVA_HOME = $ (dirname $ (dirname $ (readlink -f $ (which javac))))
Depending on your situation, the above command will write a ~ / .bashrc (or / etc / profile) file, it will set the JAVA_HOME variable permanently.

Note that since java or javac can build multiple levels of symbolic links, for "readlink -f" command is used to get their real execution path.

For example, if you are installing Oracle JRE 7, then the above-described first export order is automatically set JAVA_HOME as follows:

/ Usr / lib / jvm / java-7-oracle / jre
If you are installing the Open JDK version 8, the second export command to set the JAVA_HOME:

/ Usr / lib / jvm / java-8-openjdk-amd64


In short, these export commands you to reinstall / upgrade your JDK / JRE, or replace the automatic update JAVA_HOME variable default Java version. You no longer need to manually adjust it.
     
         
         
         
  More:      
 
- Embedded Linux to solve the problem in the time zone (Linux)
- Setting Lns firewall against ARP attacks (Linux)
- Use a soft Raid play multiple SSD hard drive performance and enhance data security (Linux)
- 10 really interesting Linux command (Linux)
- Apache site default home page settings (Server)
- How to run Docker client in Windows operating system (Linux)
- Oracle how to maintain the consistency of read? (Database)
- CentOS set up FTP server (Server)
- Build RubyMine + Ruby On Rails + MySQL development environment under Windows (Server)
- Ubuntu How to mount iso file (Linux)
- Linux suffered SYN flood attack setting (Linux)
- Linux (Debian) install software, missing dynamic link libraries .so (Linux)
- Linux Network Programming - non-blocking program (Programming)
- Archlinux installation tutorial (Linux)
- The new features of MySQL 5.7 Generated Column (index function) (Database)
- Use virt-manager to create and manage virtual machines (Linux)
- Under CentOS 7 installation and deployment environment Ceph (Server)
- Thinking in Java study notes - Generics (Programming)
- Help you make Git Bisect (Linux)
- The security administrator network analysis tools SATAN Introduction under Linux (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.