There are two ways to do the thing but doing it with Command prompt would be the easiest way. To start with the Command prompt hit “cmd” in the search after clicking on start. Now enter the commandset path="PATHNAME";eg: set path="c:\Program Files\Java\JDK\bin";and hit enter it will set your path automatically. Now you are ready to run your first Java program.