Pure Sublime coding and running Java Program using Sublime Text Editor

Sublime Text editor is a great no-frills text editor that has been created keeping the programmer in mind. It has a vast array of various programming language syntax, coloring, and code insights.

We have the functionality of building (make) a Java program from within Sublime by pressing Ctrl+B

We can extend this functionality to run the Java program.

For this, Browse the sublime packages by Preferences > Browse Packages from the Sublime Editor Menu.

Capturesublime

Backup the Original JavaC.sublime-build file.

Open the JavaC.sublime-build file in NotePad or in sublime itself!

Replace this

{
    “cmd”: [“javac”, “$file”],
    “file_regex”: “^(…*?):([0-9]*):?([0-9]*)”,
    “selector”: “source.java”
}

with this (must be one single line)

{  “cmd”: [“javac”, “$file_name”,”&&”,”java”, “$file_base_name”],  “file_regex”: “^(…*?):([0-9]*):?([0-9]*)”,  “path”: “C:\\Java7\\bin\\”,  “selector”: “source.java”,  “shell”: true  }

where C:\\Java7\\bin\\ will be path to your Java JDK \bin

Code away. Build and Run !!!

Capturesublime2

Advertisements