title: IOException: Cannot run program "javac" when "sudo ./sbt/sbt compile" in Spark?
body: <p>I'm installing <a href="https://spark.incubator.apache.org/" rel="noreferrer">Apache Spark</a> which uses its own copy of SBT to set things up.</p>
  
  <p>I'm using Linux Mint in a VirtualBox VM.</p>
  
  <p>Here's a snippet from the error when I run <code>sudo ./sbt/sbt compile</code> from the Spark directory <code>spark-0.9.0-incubating</code>:</p>
  
  <pre><code>[error] (core/compile:compile) java.io.IOException: Cannot run program "javac": error=2, No such file or directory
  
  [error] Total time: 181 s, completed Mar 9, 2014 12:48:03 PM
  </code></pre>
  
  <p>I can run <code>java</code> and <code>javac</code> from the command line just fine: e.g. <code>javac -version</code> gives <code>javac 1.6.0_31</code></p>
  
  <p>The correct <code>jdk1.6.0_31/bin</code> is in my <code>PATH</code>.</p>
  
  <p>I read that the error might be due to the 64-bit JDK that I had installed, but I get the same error with the 32 bit JDK.</p>
  
  <p>How can I sort out the issue?</p>
  
  <p>edit: Using bash shell.</p>