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.9k Views 2 Watching
    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 Offline
      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 Offline
        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 Offline
          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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors