If you save the Java source file inside the JDK/bin directory, the path does not need to be set because all the tools will be available in the current directory. The path must be set in order to use tools like javac, java, etc.
Where do I add Java?
The JDK software is installed on your computer, for instance, at C:Program FilesJavajdk1. Go to http://java.sun.com/javase/downloads/index.jsp, choose the relevant JDK software, and click Download.
How is JAVA_HOME used?
In Windows, JAVA_HOME is primarily used to set the path of the java program, as well as the paths for other programs like java EE, ANT, and Maven.
Where is my Java path in Windows?
By going to Control Panel > Programs > Java in Windows 10, you can find the path by following the instructions in the panel that appears, as shown in the screenshot below.
To create or modify environment variables on Windows 10:
- Right-click the Windows icon in the taskbar and choose System.
- Click Advanced system settings in the Settings windows Related Settings section.
- To access environment variables, select the Advanced tab.
- To add a new environment variable, click New.