title: Sublime Text 2 - Out of the box Compiling and running Java programs
body: <p>OS:</p>
  
  <pre><code>Distributor ID: Ubuntu
  Description:    Ubuntu 12.04.2 LTS
  Release:    12.04
  Codename:   precise
  </code></pre>
  
  <p><strong>Sublime Text 2 is 2.0.1 for Linux 32-bit</strong></p>
  
  <p>There is JAVA_HOME set up in my environment and JAVA_HOME/bin included in $PATH</p>
  
  <pre><code>  $ cat /etc/bash.bashrc
    export ENV_HOME="/media/work/Environment"
    export JAVA_HOME="$ENV_HOME/Java/jdk1.7.0_04"
  
    export PATH=$PATH:$JAVA_HOME/bin
  </code></pre>
  
  <p>Isn't Java program compilation and running supported out-of-the-box without any manual configurations or modifications?</p>
  
  <p>When I am trying to build my simple program Test.java</p>
  
  <pre><code>  class Test {
    public static void main(String[] args) {
        System.out.println("Jignesh Gohel");
    }
    }
  </code></pre>
  
  <p>I am getting the following error in Sublime Text console:</p>
  
  <pre><code>  [Errno 2] No such file or directory
    [cmd:  [u'javac', u'/media/work/Java/Test.java']]
    [dir:  /media/work/Java]
    [path: /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games]
    [Finished]
  </code></pre>
  
  <p>Following is the JavaC.sublime-build content:</p>
  
  <pre><code>  {
        "cmd": ["javac", "$file"],
        "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
        "selector": "source.java"
    }
  </code></pre>
  
  <p>I found following links mentioning solution to my above query:</p>
  
  <p><a href="https://gist.github.com/jfcalvo/3789664" rel="nofollow noreferrer">https://gist.github.com/jfcalvo/3789664</a>
     <a href="http://www.compilr.org/compile-and-run-java-programs/1251/" rel="nofollow noreferrer">http://www.compilr.org/compile-and-run-java-programs/1251/</a>
     <a href="https://stackoverflow.com/questions/13271147/cant-compile-java-with-sublime-text-2-ubuntu-12-04-64">Can&#39;t compile Java with Sublime Text 2, Ubuntu 12.04 64</a></p>
  
  <p>but they still require me to make modifications manually.</p>
  
  <p>Thanks,</p>
  
  <p>Jignesh</p>