Java IDEs and Editors III: Sublime Text and Editplus

Programming editors are lightweight development environments. They are not fully featured like IDEs but they are extremely lightweight. A programming text editor typically provides facilities for syntax highlighting, writing, compiling and running programs. The main advantage of a programming editor over an IDE is its small footprint. You can get a sense of the difference from the fact that a typical IDE is at least 200 MB download but a programming editor is around 5 MB download.

Using Editplus to Develop Java Code

Editplus is one of the oldest programming editors. It is also one of the most configurable ones. Once you learn the basics of programming in Editplus, you can configure it for almost any other programming language. One of the remarkable things about Editplus is that its UI, look and feel has changed very little  in the course of last two decades. That is a breathtaking statement about anything in the software world and points to the amazing the foresight the designers might have had in an era where Windows 95 was considered the coolest operating system. Here is how Editplus looks like –

Edit plus for Java 1

Compiling and Running Java Programs in Editplus

You can configure Java compiler and the Java runtime environment using Tools -> Configure User Tools as shown below –

editplus tools configuration

Next Add Tool -> Program

add javac in editplus

This is how complete configuration for javac looks like –

editplus java

Now you can run javac on the current file using Ctrl + 1 or Tools -> Java Compiler.

You need to repeat the steps above for Java interpreter (java). Note that for interpreter you also need to specify the initial directory from where your java command must be launched.

Configuring Java Intepreter in Editplus

Now you are ready to compile and run your Java program as shown in the screenshot below –

Running and Compiling Java programs in Editplus

Using Sublime Text Editor to Develop Java Code

Sublime Text is another programming editor that has gained a lot of traction in recent years. It is especially popular among web developers. The screenshot below shows how Sublime Text looks like –

sublime text java 1

Compiling Java Code in Sublime Text

Sublime Text can be used to compile and run Java programs, though running Java programs is not supported out of the box. Compiling in sharp contrast is supported out of the box. You just need to adjust your build system and press Ctrl + B as shown in the screen captures below –

javac in sublime text

Running Java Code in Sublime Text

Running Java code is not supported out of the box. You need to either create a new Sublime Text build system or modify an existing one. Since it is always risky to try to modify something which is working, we will create a new build system.

Go to Tools -> Build System -> New Build System

Now paste the following code –

1 2 3{ “shell_cmd”: “java ${file_base_name}” }

And save the file as CodingRaptor.sublime-build in the User directory of Sublime Text’s Application Data directory. So, this would be the path of User directory – C:\Documents and Settings\$USERNAME\Application Data\Sublime Text $VERSION\Packages\User

Once you save the above file you will have a new build system by the name CodingRaptor available to you. Now change your build system to CodingRaptor and press Ctrl + b to run the Java interpreter on the class file generated in previous step. The screen captures below show how to run Java code in Sublime Text –

CodingRaptor Build System for Java

Running Java Interpreter from Sublime Text

Although we have dealt with how to compile and run Java programs in Sublime Text and Editplus, the process is similar for other popular programming editors such as Notepad++, Programmer’s Notepad, Synwrite, Brackets and the aged, time-tested Textpad.

Leave a comment

Your email address will not be published.