The situation before the blogger configuration
1.64-bit notebook 2. WIN10 System 3. The Java Environment 4 has been configured. Sublime is installed and the package control component is configured.
Specific process:
1. Sublime Text 3--->preference--->browse Packages, double-click the user folder in the open window and create a new file named "Javac.sublime-build" under the folder. Open the file with sublime, paste the following code and save
{ "cmd": ["Javac", "-encoding", "UTF-8", "-D", ".", "$file"], "File_regex": "^ (... *):( [0-9]*):? ([0-9]*) ", " selector ":" Source.java ", " encoding ":" GBK ", //execute the above command at the end //The following command needs to press CTRL+SHIFT+B to run "Variants": [{ "name": "Run", "shell": true, "cmd": ["Start", "cmd", "/C", "Java ${file_base_name} &echo. & Pause "], ////C is to close the cmd window after executing the command, ///k The cmd window is not closed after the command is finished. //echo. Equivalent to entering a carriage return //pause command to make the cmd window Press any key before closing "Working_dir": "${file_path}", "encoding": "GBK" }]}
2. Create a new test file and save it as Hello.java
ImportJava.util.Scanner; Public classHello { Public Static voidMain (String args[]) {Scanner s=NewScanner (system.in); System.out.println ("Input string, exit terminates ====>"); while(S.hasnextline ()) {String line=S.nextline (); if(Line.equals ("Exit")) Break; System.out.println ("Out==>" +Line ); } }}
3. Press Ctrl+shift+b will pop up an option, for example, select "JavaC" to compile;
Press Ctrl+shift+b to select "JavaC Run".
Operating effect:
Transfer from https://my.oschina.net/xldc/blog/468862
Sublime Text 3 Configuring the Java Program Runtime Environment (console input available) (RPM)