Notepad++ is a popular and free source code editor which is widely used by programmers. Even I use it very frequently. Today while editing a source code on notepad++ I thought that it will be great if there is any way to run the source code on it. Luckily I found a way that I am sharing below. I have mentioned steps only for C, C++ and Java. But the same method can be used to run programs of any other language.
Also Read: How to Run C and C++ Program in Sublime Text
Configure Notepad++ to Run C, C++ and Java Programs
1. First of all download the notepad++ from below link.
2. Now install and open notepad++.
3. We require NppExec plugin that will help us to run programs. You can skip 3rd and 4th steps if the NppExec plugin is already present in notepad++. Go to Plugins > Plugin Manager > Show Plugin Manager.
4. Make sure you have internet connection because we are going to download plugin. In the new window you will get a list of all available plugins. Scroll down and select NppExec plugin from the list and install it.
5. Go to Plugins > NppExec > Execute. Now we have to create a script. In the new window enter following commands and then save it with any name.
For C and C++
C:\Program Files (x86)\Dev-Cpp\MinGW64\bin\g++.exe “$(FILE_NAME)”
cmd /c “$(CURRENT_DIRECTORY)\a.exe”
C:\Program Files\Java\jdk1.8.0_45\bin\javac “$(FILE_NAME)”
C:\Program Files\Java\jdk1.8.0_45\bin\java “$(NAME_PART)”
Replace “C:\Program Files (x86)\Dev-Cpp\MinGW64\bin” and “C:\Program Files\Java\jdk1.8.0_45\bin” with the path where compiler is installed in your computer.
6. Then go to Plugins > NppExec > Advance Options. In the bottom left corner you will get a list of Associated script. Select the script that you have just created from the drop down list.
7. Click on Add/Modify button. Now you can see the script in the Menu items box at the top.
8. Click OK button, you have to restart the notepad++.
9. After that go to Settings > Shortcut Mapper. Click on Plugin commands tab, there you will get the list of all the commands. Scroll down until you see the command with the name with which you have saved the script.
10. Click on Modify button to choose a shortcut according to you. Make sure the shortcut is unique. Now close the window.
11. Just write your program and run it using the shortcut key you created in previous step. You can see the output in the Console window as shown below.
So this was the simple method to configure notepad++ to execute C, C++ and Java programs. If you are getting any problem then comment below, I will try to solve your problem.