Reference
The first thing is to install the JDK configuration environment variable, this is not much to say.
The second step is to download and install sublime Text3.
The third step is to create a batch file named Runjava.bat, which is placed under the bin of the JDK:
1@ECHO OFF2cd%~DP13ECHO Compiling%~nx1 .....4 IFEXIST%~n1.class (5DEL%~n1.class6 ) 7Javac%~nx18 IFEXIST%~n1.class (9ECHO-----------OUTPUT-----------TenJava%~n1 One)
Expand
Fourth step, find the sublime installation directory under the Packages Java.sublime-package, open with the compression software, find javac.sublime-build this file. This file may not be modified directly, can be copied out in the outside to be modified and then overwritten back (better to do a backup). File modified to:
1 {2 "Shell_cmd":"runjava.bat \"$file\"",3 "File_regex":"^(...*?):( [0-9]*):? ([0-9]*)",4 "selector":"Source.java",5 "encoding":"UTF-8"6}
View Code
Then write a test code:
1 Public class demo{2 Public Static void Main (string[] args) {3 System.out.println ("Lalala demacia"); 4 }5 }
View Code
Pressing the shortcut key CTRL + B will result in the following results, but if the code has errors it will not error ... :
Write and run the Java program on sublime Text 3