How to Compile .java file from anywhere (setting PATH)

How to Compile .java file from anywhere CMD
 (setting PATH)

First you need to know what does path do, if you do not set path you will have to compile your files using CMD from \bin folder in the program files. To avoid this and to compile from anywhere using CMD you need to set path it's easy.
1. To set up the path after you have installed JDK and JRE goto the folder where JDK is installed and find filder bin.



2. In Folder bin copy the address in the address bar. Now Go to  properties of 'My Computer' and click Advanced System Settings.


3.Now click on Environment Variables and select PATH from lower part and click EDIT, now in the beginning of 'variable value' field paste the path you copied earlier. Then type ' ; ' semicolon and click 'ok'. DONE ! now you can compile from anywhere.


NOTE: this is for those who dont use IDE's like Eclipse and NetBeans. I would recommend to use IDE instead of CMD for Compiling.

No comments:

Post a Comment