How to set path in Java

There are 2 ways by which you can set the path. 

  1. Temporary
  2. Permanent

Setting the path is necessary for using javac, java that is compiling and running tools used in the command prompt.

  • Temporary Method – You can set the temporary path but you have to set the path again once you closed the command prompt.
  • Step 1 – Open the Command Prompt.
  • Step 2 – write this in CMD: set path= copied path from the JDK/Bin directory.

  • Permanent Method – By the permanent method you can set the path permanently and you don’t have to copy the path again and again.
  • Step 1 – Go to my computer ->  click on system properties -> click on advanced system settings ->  click on environment variables -> go to the path and paste the copied path from JDK/bin directory

 

Leave a Reply