I created a Java program and tried to compile it by command line via following command but it gave me the following error
E:Java>javac HelloClass.java
‘javac’ is not recognized as an internal or external command,
operable program or batch file.
E:Java>javac HelloClass.java
‘javac’ is not recognized as an internal or external command,
operable program or batch file.
So what was wrong in it? To compile Java program we need to set JDK path instead of JRE that was in my case. So I simply set the JDK path via following command and then I compiled my program it worked fine.
E:Java>set PATH=”C:Program FilesJavajdk1.7.0_75bin”
E:Java>java -version
java version “1.7.0_75”
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
E:Java>Javac ForLoopPrintStars.java
E:Java>