Please keep in mind that compiling in the windows shell works, so there is little (if not zero) possibility of this issue being a PATH issue.
I have spent a lot of time research how to do this, and all the results I found online say that you can do:
NPP_SAVE
javac $(FILE_NAME)
java $(NAME_PART)
but that does not work for me. In the NPP_EXEC console, I can type java, and I get the normal results as I would from cmd, but any time I type javac, I get the dreaded error code 2 error:
================ READY ================
javac
javac
CreateProcess() failed with error code 2:
The system cannot find the file specified.
================ READY ================
I must clarify some confusion:
Sorry for the confusion...
I have set it very easily by using this Article or you can also see another blog post which is very easy and helpful.
Now come to the point that how we can set the N++ and NppExec so our program run with on a single hand by N++.
Save this script first with the name of Java Compile
NPP_SAVE
cd "$(CURRENT_DIRECTORY)"
"C:\Program Files (x86)\Java\jdk1.7.0\bin\javac" $(FILE_NAME)
here the main thing is your path of the java compiler, as in my case it is in C
directory and most probably in the same of yours but still difference between 32bit and 64Bit OS.
Now save this scrip with another name like Compile and Run
cd "$(CURRENT_DIRECTORY)"
"C:\Program Files (x86)\Java\jdk1.7.0\bin\java" -classpath "$(CURRENT_DIRECTORY)" "$(NAME_PART)"
Now add the script to the Macro in N++ to work it from there,
go to Advance Options within NppExec plugin,
A: Check the box at the top that says “Place to the Macros Submenu”
B: select script from “Associated Script” combo box. It will automatically fill in the “Item Name”
C: Now click the “Add/Modify” button.
D: Click OK. This will exit the Advanced Options box and say that NotePad++ needs to be restarted (don’t restart it until other scripts have been added).
We have to click OK because it’s the easiest way of clearing the boxes to add the next script otherwise it’s likely to overwrite the existing menu option.
E: Repeat these steps to add the other scripts and then restart it.
Its done now.