1, Sublime Text 3--->preference--->browse Packages, double-click the user folder in the open window, Create a new file Javac.sublime-build, open it with Notepad, paste the following code, and save the shutdown:
{"
cmd": ["Javac", "-encoding", "UTF-8", "D", ".", "$file"],
"File_regex": "^ (... *?):( [0-9]*]:? ([0-9]*) ",
" selector ":" Source.java ",
" encoding ":" GBK ",
//The end of the command above
///The following command needs to be run by ctrl+shift+b
"Variants": [{
"name": "Run",
"shell": true,
"cmd": ["Start", "cmd", "/C", "Java ${file_base_name}" &echo.
//Echo. The equivalent of entering a carriage return
//pause command to have the cmd window press any key before turning off
"Working_dir": "${file_path}",
"encoding": "GBK"
}]
}
2, new test file, save as Hello.java:
Import Java.util.Scanner;
public class Hello {public
static void Main (String args[]) {
Scanner s = new Scanner (system.in);
System.out.println ("Input string, exit termination ====>");
while (S.hasnextline ()) {
String line = S.nextline ();
if (Line.equals ("Exit")) break
;
System.out.println ("out==>" +line);}}
3, first press ctrl+shift+b will pop up an option, the following figure, select "JavaC" to compile;
Then press Ctrl+shift+b to select "JavaC Run".
The operation effect is as follows:
Reprint Source: https://my.oschina.net/xldc/blog/468862