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 ??