IDE

Solve how to compile and run Java in SublimeText 2

24 Sep , 2012  

I found a lot of people discussing about how to compile and run the results of Java (single file) in SublimeText 2. Well, after trying another alternative and failing, finally I found how to make it works. It’s easy actualy, all you need are:

1. Edit SublimeText2 Java Build

1
~/.config/sublime-text-2/Packages/Java/JavaC.sublime-build


2. Configure SublimeText 2 to run Java and showing results after compile

1
2
3
4
5
{
        "cmd": ["sh", "-c", "javac $file_base_name.java && java $file_base_name"],
        "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
        "selector": "source.java"
}

3. Close and re-open your SublimeText

4. Set build into Java environment (or auto)

5. Test build and Run Java by CTRL + B

6. You should see Java results appear in SublimeText Console

,


Leave a Reply

Your email address will not be published. Required fields are marked *