title: How to create a .bat file to execute java .class files
body: <p>I have a java .class file in <code>D:\Test\aaa\bbb\ccc\test.class</code></p>
  
  <p>Say I would like to make a .bat file to execute the test.class and I would like to <strong>put the batch file in the bbb folder.</strong></p>
  
  <p>I rely on eclipse a lot therefore I am poor at compiling and running programs that are not handled by the ide....</p>
  
  <p>I have tried to make a batch file via notepad and I have tried to make my batch file work</p>
  
  <pre><code>@echo off
  set JAVA_HOME=d:\tools\jdk1.7.0_80
  set path=.;%JAVA_HOME%\bin;%path%
  </code></pre>
  
  <p>the only thing I know at the moment is setting the java path </p>
  
  <p>If this were a .java file I would probably write</p>
  
  <pre><code>javac \ccc\test.java
  java  \ccc\test
  </code></pre>
  
  <p>Like I mentioned I want the .bat file in the bbb folder, not sure if the above is even correct or not</p>
  
  <p>but the real question is that it is a .class file , do I just omit the javac part? or do I have to do something else? what command will correctly execute the batch file and run the test.class?</p>