After installing a java platform you need to set a path for the operating system to find JDK packages and convert the source code into an executable code.
Note: If your java files are being saved inside the JDK/bin folder then there is no need to set the path because the required tools such as java, javac will lie inside the active directory.
But if your files are being saved outside the JDK/bin file then you need to set a path.
Setting a Path in Java
In order to set a permanent in Java follow the below-mentioned steps.
1. Go to MyPc Properties
2. Select Advanced System Settings
3. Select Environment Variables
4. Select New Tab of User Variable
5. Write path name in section of Variable Value
6. Copy Path of Bin Folder
7. Paste Path in Variable Value
8. Click OK
9. Click OK
Following the above step, you can easily set a path in java and run a java program from any drive.
To set path in Java we have to set the environment variables. We first have to copy the path of JDK bin folder and paste it into the environment variables list by going into the settings > system > about > advanced system settings and selecting the environment variable to edit the path for java JDK. However, If your files are saved inside the JDK/bin folder then there is no need to create a path but if your files are being saved outside then you have to create a path. This post demonstrates two ways to set path in Java; temporary and permanent.