How to Compile and Run Java within Notepad++


When you are learning a programming language such as Java it is always recommended not to make use of IDEs like Eclipse or IntelliJ as when you type code without the help of real-time compilation error highlighting and intellisense, you make a lot of error, but that's how you learn the syntax of the language quickly.

So you can make use of editors like Notepad++ in such cases, as they will syntax highlight your code.

If you want to compile and execute your Java code within Notepad++ then you should make use of the Java Plugin.

Plugin to Compilation and Execution Java Code directly from Notepad++

You can install it from the Menu: Plugins -> Plugin Admin

Once the installation is done you can compile your Java classes by going to Plugin -> Java Plugin -> Compile.

Note:

Make sure to set the JAVA_HOME enviroment variable or else you will get an error.

>>> INFO: Compiling File "NotepadPlusPlus.java"...
>>> ERROR: JAVA_HOME property is empty
>>> ERROR: Detected invalid configuration, compile action will not be performed.

Next you can Run the code and should see the output in the "Java Console"

Compile and Run Java Code in Notepad++

Shortcut List:

Compile: Shift+F8

Run: Shift+F9

Compile and Run: Shift+F10

Clear Java Console: Shift+F11

Show/Hide Java Console:Shift+F12

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap