How to set path in Java

The path is required to be set for using tools such as javac, java etc.If you are saving the java source file inside the jdk/bin directory, path is not required to be set because all the tools will be available in the current directory.

But If you are having your java file outside the jdk/bin folder, it is necessary to set path of JDK.

There are 2 ways to set java path:

★ temporary

★ permanent

How to set Temporary Path of JDK in Windows

★ Open command prompt

★ copy the path of jdk/bin directory

★ write in command prompt: set path=copied_path

How to set Permanent Path of JDK in Windows

★ Right-click the My Computer icon on your desktop and select Properties.

★ Click the Advanced tab, then click the Environment Variables button.

★ Under System Variables, click New.

★ Enter the variable name as JAVA_HOME.

★ Enter the variable value as the installation path for the Java Development Kit.

★ Click OK.

★ Click Apply Changes.