Community
    • Login

    What is the script for NPPExec, to compile and run java application on Notepad++ 7.6.3

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 1.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Abdelrahiman SolimanA
      Abdelrahiman Soliman
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones
        last edited by PeterJones

        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)"
        
        1 Reply Last reply Reply Quote 3
        • Abdelrahiman SolimanA
          Abdelrahiman Soliman
          last edited by

          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.

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors