How to run Java applications in Notebook++ version 7.9

  • I want to run in Notpad++ ,but it showed error. I have run under NetbeansProjects directory successfully. How to debug this running java application process?

  • @Vinod-Dhamnekar ,

    We cannot be expected to be Java experts and thus debug any Java problems you might be having – as a forum for a text editor, doing programming debugging is off topic.

    From the Notepad++ standpoint, it appears you are using the NppExec to run javac on the active file. It’s using the command javac to call that. If you were at a normal command prompt (cmd.exe or powershell), would that command be sufficient? Do you know what command-line that NetbeansProjects uses when calling your ?

    I haven’t done any java recently, but a few years ago, I played around with it some. At that time, I had created a java-compile and java-compile-and-run script for NppExec:


    javac "$(FILE_NAME)"

    compile then run

    javac "$(FILE_NAME)"
    java -classpath "$(CURRENT_DIRECTORY)" "$(NAME_PART)"

    You will notice that I do slightly more than just run javac: first I make sure the file is saved (otherwise javac will see the last-saved version, which might not match what I have open in Notepad++ if I’ve forgotten to save first); second, I change into the same directory that the .java file is saved in (NppExec doesn’t guarantee it will set up its environment in the same folder); then third, I use javac to compile the .java source code.

    Also, looking briefly at your error message in the console, it says “class SimpleCalculator is public, should be declared in a file named”, but your file is called . I don’t remember enough of my java to be sure, but a quick google told me that “the public class name must match the file name. Inner, non public, class names may differ.” – this strongly tells me that you should rename the file Notice, you even say,

    I want to run in Notepad++ ,but it showed error. I have run under NetbeansProjects directory successfully.

    You said that you have the file called in Notepad++, but you had a file called when you ran it under Netbeans. That lends strength to the suggestion that you should try running it with the filename and the public class name matching.

    If you have more questions that are specific to Notepad++ and NppExec, feel free to ask follow ups.

  • @PeterJones As per your suggestion, I renamed the file to
    Please tell me in NppExec\execute window, are there any errors in writing command syntax? See the following picture.

    with regards,

  • @Vinod-Dhamnekar ,

    I gave you the literal contents of the script. You did not need to manually put in the values.


  • I actually like this name “Notebook++”. It looks fresh!
    Sorry for off-topic.😀

  • This post is deleted!

  • @PeterJones I successfully implemented the SimpleCalculator java program( by moving its locations to Documents folder) under NppExec plugin and obtained the desired result in Notepad++
    With regards,

Log in to reply