+91 9404 340 614    gyaanibuddy@gmail.com


Setting Java variables in Linux

Last updated on Sept. 13, 2022, 5:20 a.m. by tushar

Your operating system can locate the necessary Java programmes and utilities by using the variables JAVA HOME and PATH.

Steps to follow setting Java variables in Linux: 

  1. Set JAVA_HOME using the syntax
    export JAVA_HOME=path
    to JDK.
    For example, 
    export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64"

    [Make sure there is no space before and after '=', else you will get error.] 

  2. Set PATH using the syntax

    export PATH=${PATH}:path

    to the JDK bin.
    For example, 

    export PATH=${PATH}:/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin


  3. Use the commands below to check the settings.:
    echo $JAVA_HOME
    echo $PATH

    The JAVA_HOME and PATH variables you set must appear in the output.


by tushar
KJ Somaiya College of Engineering Mumbai

Software Engineer | SWE Intern'21 @ConnectWise | Ex- Smollan | KJSCE CSE'22
blog comments powered by Disqus