title: How can I compile and run a Java class in a different directory?
body: <p>I'm writing a makefile that compiles a <code>.java</code> file in a different directory, and then I want to run it, without changing directories. I want to do something along the lines of:</p>
  
  <pre><code>$(SQM_JAVA_TOOL_DONE) : $(SQM_JAVA_TOOL)
          $(shell cd /home_dir)
          javac myjavafile.java
          java myjavafile
  </code></pre>
  
  <p>where the Java file is <code>/home/myjavafile.java</code>, and the makefile isn't running from <code>/home</code>. </p>
  
  <p>How can I do this?</p>