Run a Java program

  • I wan´t to run an program with Notepad ++. But it keeps saying this:
    ; about to start a child process: “java Test”
    CreateProcess() failed with error code 2:
    The System can´t find the file.

    What can I do to fix that?

  • On the rare occasions I run Java from Notepad++ (I think it’s been a couple years since I tried playing with Java), I use the NppExec plugin to run the script

    "C:\Program Files (x86)\Java\jdk1.8.0_51\bin\javac" $(FILE_NAME)
    "C:\Program Files (x86)\Java\jdk1.8.0_51\bin\java" -classpath "$(CURRENT_DIRECTORY)" $(NAME_PART)

  • I realized I didn’t really complete my thought.

    You can define that script in the Plugins > NppExec > Execute dialog, and Save… it with a meaningful name (I use Java-CompileAndRun) , then use that plugin’s Advanced Options interface to add the script to the Macro menu (may require reloading Notepad++ after that). After it’s in that menu, you can use Shortcut Mapper to assign it a keyboard shortcut.

    From then on, if you have a java source code in the active editor tab, running that script through the Macro menu or through the keyboard shortcut will compile and execute the active java program.

Log in to reply