 <p>I think that this question was already answered here: <a href="http://stackoverflow.com/questions/16137713/how-to-run-a-java-program-from-the-command-line">How to run a java program from the command line</a> and the sorce is here: <a href="http://www.skylit.com/javamethods/faqs/javaindos.html" rel="nofollow">http://www.skylit.com/javamethods/faqs/javaindos.html</a></p> <p>For this example your file is in <code>C:\mywork\</code></p> <p>Type</p> <pre><code>C:\&gt; cd \mywork </code></pre> <p>This makes <code>C:\mywork</code> the current directory.</p> <pre><code>C:\mywork&gt; dir </code></pre> <p>This displays the directory contents. You should see HelloWorld.java among the files.</p> <pre><code>C:\mywork&gt; set path=%path%;C:\Program Files\Java\jdk1.8.0_51\bin </code></pre> <p>(use the JDK folder for the version installed on your system). This tells the system where to find JDK programs.</p> <pre><code>C:\mywork&gt; javac HelloWorld.java </code></pre> <p>This runs javac.exe, the compiler. You should see nothing but the next system prompt...</p> <pre><code>C:\mywork&gt; dir </code></pre> <p>javac has created the HelloWorld.class file. You should see HelloWorld.java and HelloWorld.class among the files.</p> <pre><code>C:\mywork&gt; java HelloWorld </code></pre> <p>This runs the Java interpreter. You should see the program output:</p> <pre><code>Hello, World! </code></pre> <p>If the system cannot find <code>javac</code>, check the set path command. If <code>javac</code> runs but you get errors, check your Java text. If the program compiles but you get an exception, check the spelling and capitalization in the file name and the class name and the <code>java HelloWorld</code> command. Java is case-sensitive! </p>