There are many solutions that say the same thing without providing step-by-step instructions. So here is my experience on Mac'16 with Sublime Text 3 :
Open a terminal window and do the following:
$ cd / Applications / Sublime \ Text.app/Contents/MacOS/Packages/
Made a temporary directory to link.
$ mkdir java
Copy the current Java.sublime package to the new java directory and go to java.
$ cp Java.sublime-package java /
$ cd java
Then unzip the package to see the contents:
$ unzip Java.sublime-package
Now edit the JavaC.sublime-build assembly file. If you have an elevated text command line script:
$ subl JavaC.sublime-build
Otherwise
$ vi JavaC.sublime-build
Then I copied the following into my JavaC.sublime-build, which I found here, published by Sean Mullen :
{ "cmd": ["javac \"$file_name\" && java \"$file_base_name\""], "shell": true, "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "selector": "source.java" }
After that, save and, being inside the java directory, type:
$ zip Java.sublime-package *
Move the new assembly package to the desired folder (parent directory):
$ mv Java.sublime-package ../
UPDATE: 04/18/18: Sorry for taking so long to correct this answer. Based on @bumbu's comments, we need to run the following command before deleting the temporary directory:
$ cd ..
Delete Java temporary directory:
$ rm -fr java /
AND DONE. Now building the Java file will also try to run it. I prefer this behavior instead of making another "option" to run the program.