Sublime with Java compiler function, at that time only compile can not run, we make a little change can let sublime a step to complete the function of compiling and running, implement sublime build Java compiler platform.
When compiling with CTRL + B, the compiled file cannot be stored in a path that contains Chinese.
The first step:
Find the JDK development package on your machine, mine is in C:\Program Files\java\jdk1.6.0_43\bin, a new batch file named Javacexec.bat with the following file contents:
%~%~nx1-encoding utf-8%~n1
@ECHO OFF %~dp1 %~nx1 .... %~n1.class ( %~n1.class ) %~nx1 %~n1.class ( ---- -------OUTPUT----------- %~N1 )
Choose one of the two, and the second will show the prompt.
Step Two:
Sublime: Preferences-->browse packages...--> Find the Java folder, open the Javac.sublime-build file,
can also be directly: tools-->building system-->new Building System ... Create a new compilation tool.
The content is modified as follows: (blue part to solve the test Chinese garbled problem)
{ "cmd": ["Javacexec.bat","$file"], "File_regex":"^(...*?):( [0-9]*):? ([0-9]*)", "selector":"Source.java"
"Encoding": "cp936"
}
Step three: Test
1 public class Foreachtest { 2 public static void Main (String [] args) { 3 string[] books = {" C language "," Java "," Python " 4 ( String book:books { 5 system.out.printl n (book); 6 7 8 }
The results are as follows:
Sublime Text2 The Chinese garbled problem solved: In the results if you need to print Chinese, may appear in the Chinese can not print, in the second step to add the blue part of the code.
Reference Blog: http://blog.csdn.net/ys_073/article/details/8094654
http://blog.csdn.net/chszs/article/details/8232051#
Sublime Building Java compiler platform and coding problem