Monday, May 6, 2013

Notepad++ NppExec Add Java Compiler

1) If you haven't installed NppExec PlugIn, follow this tutorial,, before proceeding to the next step.

2) Configure the NppExec Plugin:

Go to Plugins > NppExec and apply the followings:
1. Disable "Console Command History"
2. Enable "Save all files on execute"
3. Enable "Follow $(CURRENT_DIRECTORY)"

3) Add Compile command:
3.1. Go to Plugins > NppExec > Execute...
3.2. Choose “Cancel” if  a Save File… dialog box appears
3.3. Enter the following command:
javac $(FILE_NAME)

3.4. Click Save. Type the name as "Compile".

4) Add Run command:


5) Add Compile and Run command:

javac $(FILE_NAME)
java $(NAME_PART)

6) Add the Execute Command Names as menu.
6.1) Go to NppExec Advance Options:

6.2)  enable "Place to the Macros submenu".

6.3) Then select “Compile” from under the “Associated script:” menu, and click the
“Add/Modify” button:

6.4) Repeat this process for the other two scripts, be careful to type the names “Run” and
“Compile and Run” in the “Item name:” box before hitting the Add/Modify button.

7) Restart Notepad++.

8) Test by creating Test.Java file.

public class Test {
public static void main(String[] args) {
System.out.println("Hello world!");

9) Go to menu  Macro/Compile.

9.1) In case you get an error like below:

9.1.1) Change your command as follows:

C:\Program Files\Java\jdk1.7.0_21\bin\javac $(FILE_NAME)

It could be caused by Windows not knowing the path to javac program (possibly true when you are using Notepad++ Portable Version, because it is running in its own memory container).

10) A successful Compile Command would result as follow:

11) A successful Compile and Run Command would result as follow:



  1. Thanks :) very good info. Now Runs!!!

  2. This comment has been removed by the author.

  3. Which file does the "C:\Program Files\Java\jdk1.7.0_21\bin\javac $(FILE_NAME)" get saved into? I want to edit that file to update the JDK path. I have many machines where I need to update the line, so I want to know which file it is, and edit that one. Then copy it to other machines.

    1. If you have installed some other version of jdk just open the path where your jdk is installed .. like in the above path which you gave "jdk1.7.0_21" as the jdk 7 version . simply edit this part with ur version of jdk .. Hope it works . If you still have some other problem mail me to

  4. This comment has been removed by the author.

    1. This comment has been removed by the author.

  5. If you need your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (even if they're dating somebody else now) you got to watch this video
    right away...

    (VIDEO) Win your ex back with TEXT messages?

  6. What if a package location is set in the source file and I do want to keep class and source files separated in "src" and "class" directory. What code could I use then?

  7. This article is really helpful for me. I am regular visitor to this blog. Share such kind of article more in future. Personally i like this article a lot and you can have a look at my services also: I was seriously search for a Salesforce training institutes in ameerpet which offer job assistance and Salesforce training institutes in Hyderabad who are providing certification material. It's worth to join Salesforce training institutes in India because of their real time projects material and 24x7 support from customer desk. You can easily find the best Salesforce training institutes in kukatpally kphb which are also a part of Pega training institutes in hyderabad. This is amazing to join Data science training institutes in ameerpet who are quire popular with Selenium training institutes in ameerpet and trending coureses like Java training institutes in ameerpet and data science related programming coures python training institutes in ameerpet If you want HCM course then this workday training institutes in ameerpet is best for you to get job on workday.