OS Authority

Tons of well written well thought and well explained programming and latest tech tutorial and videos

How to Set Up Your Java_Home Path in Windows and Linux


In this short tutorial we will teach you how to set up you JAVA_Home Path in Windows and Linux


  1. Search for Advanced System Settings in your Windows Search box. Click on Advanced System Settings.
  2. Click on Environment variables button: Environment Variables popup will open.
  3. Goto system variables session, and click on the New button to create a new variable (HOME_PATH), then New System Variables popup will open.
  4. Give Variable Name: JAVA_HOME, and Variable value: Your Java SDK home path. Ex: C:\Profram files\java\jdk1.8.0_151 Note: It should not include \bin. Then click on the OK button.
  5. Now you are able to see your JAVA_HOME in system variables list.
  6. Select Path (from system variables list) and click on Edit button, A new pop will opens (Edit Environment Variables). It was introduced in Windows.
  7. Click on New button and give %JAVA_HOME%\bin at the highlighted field and click Ok button.


Install for Single User :

  1. Check if JAVA_HOME is already set ,
    • Open Console
    • Execute : echo $JAVA_HOME
    • If output is a path , then your JAVA_HOME is set , make sure the path is correct
    • If output is empty , then execute following steps
  2. Make sure you have installed Java already
  3. Execute: vi ~/.bashrc OR vi ~/.bash_profile
  4. add line : export JAVA_HOME=/usr/java/jre1.6.0_04
  5. save the file
  6. source ~/.bashrc OR source ~/.bash_profile
  7. Execute : echo $JAVA_HOME
  8. Output should print the path

Install for all users :

  1. Login as root or execute commands with sudo
  2. Execute: bash
  3. Execute: vi /etc/bashrc OR vi /etc/profile
  4. do the same steps as done for single user

Leave a Comment

Your email address will not be published. Required fields are marked *

fifteen − fifteen =

This div height required for enabling the sticky sidebar