Page Contents
What Is Notepad++?


Notepad++ (npp) is a free source code editor for Windows.

The following short step-by-step will take through installing Notepad++ and also setting it up as a "minimal IDE" (i.e. "nice code editor").

General Tip: Closing and re-opening Notepad++ can be helpful if a particular install step did not seem to "take".

Install Notepad++


Here is the link for installing Notepad++:


it's generally fine to take the latest version

NppExec


The NppExec tool inside Notepad++ will give us some coding tools.

  • In Notepad++, open the "Plugins" menu
  • If you already have a menu item "NppExec" then skip to the step "Setup 'Compile Java' Action"

Install NppExec


If the previous step showed that you do not have NppExec, then you need to install it.

"Open "Plugins Admin""

  • Open the "Plugins" menu
  • Select the "Plugins Admin..." menu item

"Install NppExec"

In the "Plugins Admin" window:

  • Select "NppExec"
  • Click "Install"

Setup 'Compile Java' Script


  • In Notepad++, hit the "F6" key or do the menu action "Plugins - NppExec - Execute" to open the "Execute" window
  • Copy the script shown below into the script area
  • Click "Save" (lower right) -- a new small window opens
  • Enter "Script name" Compile Java
  • Click "Save" on the small window in the lower left (leave "Execute" window open for the next step")

Script:
NPP_SAVE
cd $(CURRENT_DIRECTORY)
javac -classpath "." -Xlint "$(FILE_NAME)"

Verify Script Appearance


This is what the script should look like.

Click the upper right window "x" or the "Cancel" button to close the window.

Execute Script


First open up any JAVA file in Notepad++.

Then:
  • In Notepad++, hit the "F6" key
  • Select "Compile Java"
  • Click the "OK" button to execute the script

Verify Execution


You should get output that ends with lines somewhat similar to the lines shown here (in the Notepad++ console window that opens)

NOTE -- If the script did not seem to execute, go back into execute ("F6" key) then clear the script completely out and try to re-paste in the script and save it again.
Console
javac -classpath "." -Xlint "Rectangle.java"
Process started (PID=9908) >>>
<<< Process finished (PID=9908). (Exit code 0)
================ READY ================

Setup 'Run Java' Script


  • In Notepad++, hit the "F6" key
  • Copy the script shown below into the script area
  • Click "Save" (lower right) -- a new small window opens
  • Enter "Script name" Run Java
  • Click "Save" on the small window in the lower left (leave "Execute" window open for the next step")

Script:
cd $(CURRENT_DIRECTORY)
java -classpath "." $(NAME_PART)


Click the upper right window "x" or the "Cancel" button to close the window.

Verify 'Run Java' Script


You can verify he "Run Java" using the steps you used for verifying "Compile Java"..

The only differences are:

Compile And Run Shortcuts (Optional)


With the above steps done, it is now pretty convenient. You can click the "F6" key, and choose your script, and click a button to execute it.

However, you can even make it easier. 😊

If you would like to associate compile and run directly to shortcut keys, then continue with the next steps.

Add Compile And Run To Menu


  • Open main menu item "Plugins - NppExec - Advanced Options..."
  • For "Associated Script", choose "Compile Java"
  • Verify "Item name" should contain "Compile Java" (if not, then type it in)
  • Click "Add/Modify
  • Click "OK"

Then repeat the above steps for "Run Java"
When done, close and reopen Notepad++

Verify New Menu Items


Verify that "Compile Java" and "Run Java" are on the "Plugins - NppExec" menu (probably at the bottom of the menu).

Add Shortcuts


  • Open main menu item "Run - Modify Shortcut/Delete Command"
  • Select "Plugin commands" tab
  • Find and select row that says "Compile Java"
  • Click "Modify" button
  • Choose desired shortcut key ("F11" in this example). Your choice.
  • Click OK
  • Click Close

"NOTE WELL" -- You may get warning "CONFLICT FOUND!" and the "Compile Java" row may be red. It is okay to go ahead with the above steps. The next section will show you how to fix that conflict.

Then repeat the above steps for "Run Java"
When done, close and reopen Notepad++

' Resolve Shortcut "Conflicts"'


When setting up your shortcut key you may run into a warning "CONFLICT FOUND!" and the row may be red.

That means another action is also using the same shortcut. So there are two options:


"The Conflict"

Here is the row (red) showing there is a conflict

"Fixing The Conflict"

If you decide you don't use the old shortcut mapping, then you can "clear" it.

You have to find the other/old (red) row. To do that change the tabs at the top (most actions are on the "Main menu" tab) and scroll down the list looking for the red row (and shortcuts are displayed on the row).

  • Find the highlighted (red) row
  • Verify that the shortcut is the same as the new one just added ("F11" in this example)
  • Click "Clear"
  • Click "Close"

Shortcuts Are Ready!


We should be all set. We should now be able to simply click a shortcut to "compile" and another shortcut to run. 👍🏽

For example, possibly "F11" for compile and "F12" for run -- or whatever shortcuts you choose.

Other


A few miscellaneous Notepad++ notes below.

Just for a rainy day.


Deleting/Remove shortcut --

	Open "Shortcut mapper" (e.g. Run - Modify shortcut/delete command)
	Go to desired page
	Select desired command with shortcut you want to remove
	Click modify
	Deselect Ctrl, etc and select "None" for key
	Click Ok


Handy shortcuts

	Ctrl-PgDn	prev tab (e.g. tab meaning file open in notepad++)
	Ctrl-PgUp	next tab

	change console font (e.g. Fixed / Courier)
	Menu -> Plugins-> NppExec --> Change Console Font ...


Console Tips Toggle Hide Show etc

	Far right tool on toolbar is likely console (toggle)
	Ctrl-~ toggles console
	Be sure to check checkBox "Hide toggled console" in Console (you may need to hit F3 while in console to see checkbox)