Following the instructions below, you will receive 2 Build Systems in an elevated form - "JavaC" and "JavaC_Input".
"JavaC" will allow you to run code that does not require user input and display the results in a great terminal simulator that is convenient and beautiful. "JavaC_Input" allows you to run code that requires user input in a separate terminal window, it can accept user input. You can also run code that does not require input in this assembly, so if you are not against a pop-up window, you can just stick to this assembly system and not switch. You switch between build systems from Tools → Build System. And you compile and run the code with ctrl + b.
Here are the steps for doing this:
(note: make sure you already have a basic java system setup: install the JDK and configure the correct CLASSPATH and PATH, I will not dwell on this in detail)
Setting up the JavaC build system
1. Make a bat file with the following code and save it in the C: \ Program Files \ Java \ jdk * \ bin \ folder to save everything together. Name the file "javacexec.bat".
@ECHO OFF cd %~dp1 javac %~nx1 java %~n1
2, then edit C: \ Users \ your_user_name \ AppData \ Roaming \ Sublime Text 2 \ Packages \ Java \ JavaC.sublime-build (if not, create one), the content will be
{ "cmd": ["javacexec.bat", "$file"], "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "selector": "source.java" }
"Configuring the JavaC_Input Build System"
1, install Cygwin [ http://www.cygwin.com/]
2, go to C: \ Users \ your_user_name \ AppData \ Roaming \ Sublime Text 2 \ Packages \ Java \, then create a file called JavaC_Input.sublime-build with the following contents
{ "cmd": ["javacexec_input.bat", "$file"], "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "selector": "source.java" }
3. Make a bat file with the following code and save it in the C: \ Program Files \ Java \ jdk * \ bin \ folder to save everything together. Name the file "javacexec_input.bat".
@echo off javac -Xlint:unchecked %~n1.java start cmd /k java -ea %~n1