Java Build System for Sublime Text 3

The Problem

Sublime Text is my primary text editor and I often need a build system which let me compile the source then run it if success. The build system ships with Sublime Text only compile.

The Solution

To solve this problem, I created my own build system using the following
steps:

  1. From the menu, click ToolsBuild Systems > New Build System…
  2. A new file will appear, paste in the following:
    {
        "file_regex": "(.+):(\\d+): error: ",
        "shell_cmd": "javac $file && java $file_base_name",
        "shell": true,
        "selector": "source.java",
    }
  3. Click Ctrl+S to save, type *Java Single Source.sublime-build*

Now, every time I edit a new Java source, first select the menu ToolsBuild Systems > Java Single Source, then press Ctrl+B (or Cmd+B on the Mac) to build.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s