Setting JAVA_HOME and Path Variables for Java

How many times have you loaded WinSCP, Eclipse, Apache Directory Studio, etc… on a fresh machine and have had an error popup saying the application can’t find java?

Below are simple directions on how to set JAVA_HOME and modify PATH to include JAVA. I’ll mention this now before you get copy-paste happy – the two paths are different, so pay attention to the paths in the examples.

In Windows:

      1. Click on the windows Start button

      2. Right Click on Computer and select Properties

      3. Click on Advanced System Settings

      4. Under the Advanced tab, click on Environment Variables.

      5. Under System Variables scroll down to JAVA_HOME.

a.      If JAVA_HOME does not exist, click on NEW

                                                    i.     Variable Name = JAVA_HOME

                                                   ii.     Variable Value = C:Program FilesJavajdk1.8.0_11 (This is an example, point to your version.)

                                                  iii.     Click OK

b.      If JAVA_HOME does exist, click EDIT

                                                    i.     Modify Variable Value = C:Program FilesJavajdk1.8.0_11 (This is an example, point to your version.)

                                                   ii.     Click OK

      6. Under System Variables scroll down to PATH

a.      Click EDIT

b.      Scroll to the end of the string. Notice the semi colon (;) in the below example, don’t forget it!

c.      Modify Variable Value = ;C:Program FilesJavajdk1.8.0_11bin (This is an example, point to your version.)

d.      Click OK, multiple times and close the windows

In Linux:

      1. Log into your Linux Server

      2. To set JAVA_HOME

a.      Type: export JAVA_HOME=/opt/novell/jdk1.7.0_25/bin/java (This is an example, point to your version.)

                                                    i.     Check JAVA_HOME: echo $JAVA_HOME

      3. To set PATH

a.      Type: export PATH=$PATH:/opt/novell/jdk1.7.0_25/bin/

                                                    i.     Check that your path has been added to the string: echo $PATH