NotePad++ is a free and powerful text editor which is making the works for developers and programmers so easy to edit code in multiple programming languages without shifting to  another specific language text editor to edit or write the code.NotePad++ supports  almost all the popular programming languages. And You can also define your programming language syntax too.  NotePad++ is not just the text editor it can do much more than a text editor.NotePad++ lets you to run the commands without leaving leaving editor.

This post covers on using NotePad++ to compile Java directly from NotePad++ itself i.e using NotePad++ as your JAVA IDE.

Note Java9JDK) must be installed on your computer If you don’t have java installed on your computer please install java first and then

Get the latest NotePad ++ from here[official link] which is available for free.

After downloading the latest version of NotePad++ from Run the installation.

Configuring NotePad++

  • Once you have completed installation of NotePad++ on your computer.
  • Open NotePad++ and open the Plugin menu (Alt+P)
  • Plugin—>Plugin Manager—->Show Plugin Manager.
notepad++-plugin-manger
  • When you click open Plugin manager you will get a new window with the list of available plugins and installed plugins on your Notepad++
  • Now search for the plugin named NPPEXEC  in the list of available of plugins.And install it.
  • After completion of installing the plugin NotePad++ needs to be restarted to take the changes.
  • After restating Open Plugin menu (Alt+P) you can find the installed plugin NppExec in the plugin menu.
  • And apply these settings one by one
  • Disable  “Console command history”.
  • Enable “save all files on execute”.
  • Enable “Follow $(CURRENT_DIRECTORY)”.

As shown in this below image

nppexec

Now open the execute window [F6]  and enter these commands.

To compile your code enter these commands

cd $(CURRENT_DIRECTORY)
javac $(FILE_NAME)

Explanation of the above command:-

Where the 1st line in above command will change the directory to current directory. Where your code will be saved.After saving your code the next line will invoke the Java compiler. And the rest is done by Java compiler on your java code.

After entering these codes  save it as Compile JAVA so that next time you need not to enter the code again to compile.

Now to run your java code enter these commands again in temporary code and save as RUN JAVA.

cd $(CURRENT_DIRECTORY)
java $(NAME_PART)

The first line in the above code is same as the first line of the command to compile your java code code.And the second line the above code invokes jvm to run/execute  your code.

These commands are optional in which both compile and run commands are executed at single instance.And save this command as Compile and Run Java.

cd $(CURRENT_DIRECTORY)
javac $(FILE_NAME)
java $(NAME_PART)

If you want to create the shortcuts for compiling and running the code. Then continuing reading the post.

  • Open once again the Plugin menu
  • And click on  NppExce->Advanced Options
  • Check the option “Place to macro submenu’
  • And below in the Associated script..select any one script Run or compile  at first time and click on Add/Modify button And click on OK button. (Do this step for both the scripts ).
  • So that a new menus are created under macros menu.
  • Now to create short cut keys open the settings menu.
  • Click on Shortcut Mapper
  • Find your scripts name and assign your own shortcut keys.(I prefer alt+r for run and alt+c for compile ).

Happy Java Programing!