Reading java package directory for java source using notepad/nppexec script?



  • Hello,

    Using nppexec I found a way to compile a java file and put it in a specific (package) directory using javac -d <destination> options. For this I have now a plugin command option in Macro menu which I called “Java Compile”. The code:

    cd $(CURRENT_DIRECTORY)
    javac -d C:\Users\ruijtpie\Documents\Java\rocbook\bin $(FILE_NAME)

    What I am still trying though is to run the compiled file with an other menu option “Java Run”. For that I need to be able to read the package name as a directory and put it in a code like:

    java <dir> <filename>

    I looked in much places to find any tutorial on either npp scripting or nppexec scripting, but there is not much that could help me.

    Thanks.



  • This is my NppExec java-run script:

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

    (I rarely code in java, but the couple times I have (while trying to do tutorials), that seemed to work for me)



  • When there’s a feeling of not enough help on NppExec, type the following in NppExec’s Console:

    help all
    


  • …and also:

    manual
    

Log in to reply