Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to compile java program from command prompt in Windows 7

Tags:

java

windows-7

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\

like image 833
Haritha Avatar asked Sep 02 '25 15:09

Haritha


1 Answers

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).

like image 133
Pablo Santa Cruz Avatar answered Sep 04 '25 08:09

Pablo Santa Cruz