I have set Path and ClassPath environment variables. But still I am unable to compile my HelloWorld.java program from command prompt. Please help me compile and run java program from command prompt
CLASSPATH C:\Program Files\Java\jre6\lib
Path C:\Program Files\Java\jre6\bin\
You need to add JDK's directory to your path variable (not your JRE's path as you are actually doing it). JDK is usually in:
C:\Program Files\Java\jdk1.6.0_xx\bin\
Where xx
stands for update number you have installed. Then just compile HelloWorld by using:
C:\Your\dir\where\HelloWorld\Is\>javac HelloWorld.java
In case you don't have JDK installed and you have only JRE installed, you won't be able to compile anything. You will need to download and install JDK properly to do Java Development in general (including compiling stuff).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With