What is the script for NPPExec, to compile and run java application on Notepad++ 7.6.3
-
What is the script for NPPExec to compile and run a Java application in notepad++ 7.6.3. I have this in the “commands” of NPPExec…
cd ${CURRENT_DIRECTORY}
javac ${FILE_NAME}
java ${NAME_PART}
and I applied Ctrl-X to compile and run but when I press Ctrl-X this is what I get…
NPPEXEC: “Compile_Run_Java”
CD: ${CURRENT_DIRECTORY}
Current directory: C:\Program files\Notepad++
javac ${FILE_NAME}
Process started (PID=4688)>>>
javac: invalid flag: ${FILE_NAME}
Usage: javac<options><sourcefiles>
use --help for a list of possible options
<<<Process finished(PID=4688).(Exit code 2)
java ${NAME_PART}
Process started(PID=8172)>>>
Error: could not find or load main class ${NAME_PART}
caused by: java.lang.ClassNotFoundException: ${NAME_PART}
<<<Process finished(PID=8172). (Exit code 1)
What do I do, remember this is Notepad++ 7.6.3 maybe the script is different for this version or is there another way to compile and run java? -
NppExec uses parenthesis, not curly-braces, for it’s variables, so instead of using
cd ${CURRENT_DIRECTORY} javac ${FILE_NAME} java ${NAME_PART}
change that to
cd $(CURRENT_DIRECTORY) javac $(FILE_NAME) java $(NAME_PART)
That should work for you.
if you will ever have the possibility of spaces in your filenames, use
cd "$(CURRENT_DIRECTORY)" javac "$(FILE_NAME)" java "$(NAME_PART)"
-
Thank you Mr.Peter Jones. I tried the parentheses instead of the curly braces and it compiled and run a small java application. God bless you.