How to Write, Compile and Run Java programs all within Notepad++

This post provides a link to a short Youtube video tutorial that I created illustrating the steps required to configure the Notepad++ editor on Windows so as to allow you to write, compile and run a Java program all within the Notepad++ editor and consequently, not having to use the command prompt. The major benefits to be obtained is a quicker Java development lifecycle and an accelerated learning process as you progress in learning Java.

In this video I am using Windows 7 but these steps should equally work for Windows 8 and Windows 8.1  The video tutorial assumes you have already downloaded and installed the Notepad++ editor.  If you have not done so, clear instructions are provided in a previous post.  This video tutorial also assumes you have already installed the Oracle Java JDK.

The target audience of this video tutorial are those who are relatively new to Java programming and for whom the use of a professional Integrated Development Environment (or IDE for short) such as Eclipse and Netbeans is too advanced at this stage. The solution provided in this video is a happy medium between a basic text editor and a fully professional IDE.  The benefits of using Notepad++ as an IDE are outlined in an earlier post.

By the end of this video, you will be able to compile and run any Java program by simply clicking the macro menu option and selecting Compile or Run. There will be no need to open up the command prompt and manually type the javac or java commands again.

For your convenience, I am including below the commands required by the NppExec plugin (explained in the video).

c:\java\jdk180\bin\javac $(FILE_NAME)
c:\java\jdk180\bin\java $(NAME_PART)

Note: the full path to my Java installation folder is c:\java\jdk180.  You may have installed the Oracle Java JDK into a different location, hence your full pathname may be different.  Also, I have added one additional command that is not in the video – NPP_SAVE.  This command tells the NppExec plugin to save the current Java source file being edited before attempting to compile and run it.  Thus, it eliminates the requirement to save the Java source file each time you wish to compile it.

There is a deeper motivation behind this video. Briefly, in 1984 David Kolb published what is considered a ground breaking book called Experiential Learning: experience as the source of learning and development. It facilitates an accelerated learning lifecycle.  Feedback that is received sooner and more frequently allows for corrective action to be taken at an earlier stage in the learning process, and hence leads not only to better learning outcomes, but more learning outcomes in less time. Thus, it is win-win situation. This is the pedagogical reasoning underlying my motivation to make this video tutorial – to help you learn more and better in less time.  I hope it may be of assistance to you.



One comment on “How to Write, Compile and Run Java programs all within Notepad++

  1. mmcguff says:

    I had visited several sites ranked higher than yours on google search that failed to discuss that the important of the path being correct in order for this work. Thanks for posting this. It really helped me.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s