How to set Java path

Java is not recognized as an internal or external command is a common issue, for Java beginners or sometimes for java professionals as well. The main reason behind this error is your java path or we can say Java environmental variable settings. Then the question comes how to set Java path?

Somewhere your Operating System does not get java.exe file to run Java applications and it sends back below response.

java -version

Following are few fixes which can help Java folks to set up their environment and to run java applications successfully.


How to set Java path

There are two ways for setting up java path in windows

  1. Temporary
  2. Permanent

How to set temporary Java path in windows

you need to follow below steps to setup the temporary path for Java

  1. Open windows command prompt.
  2. copy the path where you install java, upto bin directory
  3. use set path=C:\Program Files\Java\jdk1.8.0_144\bin to set path for current directory.

setting up temporary java path


How to set permanent Java path in windows

  1. Open windows command prompt.
  2. copy the path where you install java, upto bin directory
  3. go to the MyComputer->Properties-> Advanced system settings->enviornment variables->Sysem variables
  4. edit the path variable and add java path as shown in below

enviornmental-variable


Test Path

Now you can run your java program from any location of your system as given in below screenshot

Demo.java


How to set JAVA_HOME variable

Follow below steps to set up JAVA_HOME

  1. copy the path for JDK root directory just before bin.
  2. goto the MyComputer->Properties-> Advanced system settings->enviornment variables->Sysem variables
  3. select new and add the new variable entries as shown below

JAVA_HOME

Note- This tutorial is designed using windows 10 so the view can be varied. If you have other difficulties related to Java setup, please contact us via email or comments.

Please connect via comments for more explanation or queries related to Mysql issues, we will happy to help you. www.ease2code.com

Speak Your Mind

*