How to Compile and Run Code in Notepad++

0 Comments
Editor Ratings:
User Ratings:
[Total: 6 Average: 3.2]




This tutorial talks about how to compile and run code in Notepad++. I will talk about a Notepad++ plugin which will let you compile and run code from the Notepad++ interface itself. Using the plugin, you will be able to see the output of the code in Notepad++. The plugin allows you to run Java, C, C++, C#, and Python codes pretty easily. The plugin that I will talk about in this tutorial is NppExec and it lets you compile and run source code of popular programming languages.

The NppExce plugin will add a console window in Notepad++. Whenever you need to run a piece of code using Notepad++, it will show the output in that console. If you often write your code in Notepad++ and run code in other applications, then this tutorial will ease your trouble.

Compile and Run Code in Notepad++

How to Compile and Run Code in Notepad++?

NppExec plugin makes it pretty simple to run a code in Notepad++. Though the process of setting it up is pretty lengthy, but it is one-time job and later you will have to just run the code. And you will be able to run any programming language pretty easily.

Here are some steps to compile and run code in Notepad++:

Step 1: Add the plugin in Notepad++. To do this, open Plugin Manager using the Plugins > Plugins Manager > Show Plugin Manager menu. After that, find NppExec plugin in the list; select it and hit the Install button.

Install NppExec

Once the plugin is installed, you will see a NppExec menu in the Plugins menu.

Step 2: Now, you will have to add some compiling scripts in the plugin. To enter a script, press F6 key or open Plugins > NppExec > Execute menu. After that, Execute window will appear. You can paste any script of any programming language you like. After that, hit the Save button and give the script a name. Now, whenever you will need any code to run, just select the language from the Execute window’s drop down and execute the code.

NppExec script configure

Here are the scripts for some popular programming languages:

  • C/C++:

gcc “$(FULL_CURRENT_PATH)”
cmd /c “$(CURRENT_DIRECTORY)\a.exe”

  • Java:

npp_save
javac “$(FULL_CURRENT_PATH)”
java “$(NAME_PART)”

  • Python:

npp_save
python “$(FULL_CURRENT_PATH)”

  • C#:

npp_save
csc “$(FULL_CURRENT_PATH)”
$(CURRENT_DIRECTORY)\$(NAME_PART).exe

You can make script for the programming language you use the most. Or, you can also make all the scripts corresponding all the programming languages that I have mentioned.

Step 3: Now, after you have added specific or all scripts in the Plugin, type any code in the editor and execute it using the F6 keyboard shortcut. Execute window will open up; provide the script you want to use, and hit the OK button. The output of the command will appear in the console window. You can see the screenshot below.

NppExec in action

That is how you can easily compile and run code in Notepad++. And the NppExec plugin makes it very simple. Just a one time process of configuring the plugin, and it will be there whenever you want.

Also see:

My Opinion:

NppExec is a very nice plugin to compile and run code in Notepad++. Personally, I was using the traditional method to write code in Notepad++ and run it manually using Command Prompt. But, now this plugin has taken away that pain.

Editor Ratings:
User Ratings:
[Total: 6 Average: 3.2]
Works With: Notepad++
Free/Paid: Free

Leave A Reply

 

Get 100 GB FREE

Provide details to get this offer