Build a Java Development Environment Using sublime text 2

Source: Internet
Author: User
Build a Java Development Environment Using sublime text 2

Author: chszs, reprinted with note.
Author blog homepage: http://blog.csdn.net/chszs

Sublime text 2 is my favorite text editor. It is beautiful and lightweight. This article describes how to build a Java Development Environment on sublime text 2 so that you can compile and run Java programs on sublime.

1. Set the Java Path Environment Variable

(Omitted)

2. Create a batch processing or bash shell script file

Open any text editor, enter the following content, and save it as the runjava. BAT file.

@ECHO OFFcd %~dp1ECHO Compiling %~nx1.......IF EXIST %~n1.class (DEL %~n1.class)javac %~nx1IF EXIST %~n1.class (ECHO -----------OUTPUT-----------java %~n1)

Then, move the runjava. bat batch file to the bin directory of JDK.

3. Configure the corresponding Java Build Environment in the sublime text 2 editor.

Add the batch processing script you just created.
(1) Open the sublime package directory and use the menu perferences-> browse packages
(2) Select the Java directory
(3) Open javac. sublime-build and replace the following lines.

Author: chszs, reprinted with note. Blog homepage: http://blog.csdn.net/chszs

:

Changed:

4. Write a Java program and test it.

Compile a program named demo. Java with the following content:

public class Demo{public static void main(String[] args){System.out.println("This is my test program.");int a = 10;int b = 20;int c = a + b;System.out.println("Result : " + c);}}

Compile and run the Java program, and use Ctrl + B.

Result output:

Is it interesting ??

Related Article

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.