Sublime Building Java compiler platform and coding problem

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.