Facebook Twitter Gplus RSS
Home Java Tips:Compile and run java in Sublime text 2
formats

Tips:Compile and run java in Sublime text 2

Published on December 12, 2012, by in Java.

I wanted to be one front-end developer, but for my job’s need, i have to use php and learn java now. So now, i’m one new javaer. Sometimes, i find it quite funny when coding and loving it day by day.
Since i step into the programer world, i had used notepad++, editplus, e-text editor, gvim, eclipse, but i choose sublime text in the end, i find it awesome! Easy to use and easy to custom your own plugin.
Today i want to tell you how do i combine my sublime text with java’s needs, that is compile and run your java code inside sublime text.
Here is a HelloWorld.java program:

In sublime text you can use ctrl+B to compile the program, for the reason of new to java and the programs are simple, son i want to run it in the right while.
The ultimate solution:
Preference -> Browser packages, find the file JavaC.sublime-build, the javac command executed in sublime text is wrote in this file.

We can modify it, and let it run the program after compile.

I think you will understand the code rightly. After do this, when you use ctrl+B, the result will be:

Here i want to tell you another skill of use sublime text, you can also use the editor to update your changes in the run time. Plugin name: FTPsync

4 Responses

  1. Brilliant,but I think niche software or not in comparison with IDE, for example,eclipse.

  2. stephie

    Hello, Can you help me? I’m new in Sublime Text 2 and I don’t know how to compile. I followed your steps and the result was:

    ‘javac’ is not recognized as an internal or external command,
    operable program or batch file.
    [Finished in 0.0s with exit code 1]

  3. stephie

    Never mind, just now, it worked!! But thank you so much :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>