Community
    • Login

    does not open folders! How to open a file without specifying the entire path?

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    7 Posts 2 Posters 910 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.
    • Mykola BiloshytskyiM
      Mykola Biloshytskyi
      last edited by

      CD: C:\Users\User\Documents\Javaua
      Current directory: C:\Users\User\Documents\Javaua
      java -classpath C:\Users\User\Documents\Javaua\bin com.javaua.task.task02.task0202.Solution
      Process started (PID=2392) >>>
      Alina
      <<< Process finished (PID=2392). (Exit code 0)
      ================ READY ================

      CD: C:\Users\User\Documents\Javaua
      Current directory: C:\Users\User\Documents\Javaua
      java -classpath C:\Users\User\Documents\Javaua\bin com/.Solution
      Process started (PID=7120) >>>
      Error: Could not find or load main class com.
      .Solution
      <<< Process finished (PID=7120). (Exit code 1)
      ================ READY ================

      PeterJonesP Mykola BiloshytskyiM 3 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Mykola Biloshytskyi
        last edited by PeterJones

        @mykola-biloshytskyi ,

        You need to make sure that the commands that you tell the NppExec plugin to run match the same commands you would run at the command line (cmd.exe or powershell) to get the java working correctly. If the syntax java -classpath C:\Users\User\Documents\Javaua\bin com/.Solution works on a normal command line, it should work on NppExec as well.

        If there is a mismatch, you will need to make them the same. If you think they are the same, but they are behaving differently, please show exact comparisons of what is being run at your working command line and what is actually being run in your NppExec script, and we might be able to help you with the right syntax in NppExec…

        But if you’re asking a question about Java, “how do I run a specific java file from the command line without specifying the entire path”, we Notepad++ users are not expected to be Java experts, and you should find a Java forum for asking that question.

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

          @mykola-biloshytskyi

          PS: it would help if you followed the formatting recommendations in the FAQ: Formatting Forum Posts to use the </> button (which puts in ``` lines around your example text), so we now exactly what data you have, without italics, bold, etc getting in the way. And also include the NppExec script along with its output (my original phrasing made it sound like I was requestion just the output of the script, as you kind of showed above)

          1 Reply Last reply Reply Quote 0
          • Mykola BiloshytskyiM
            Mykola Biloshytskyi @Mykola Biloshytskyi
            last edited by

            @mykola-biloshytskyi said in does not open folders! How to open a file without specifying the entire path?:

            CD: C:\Users\User\Documents\Javaua
            Current directory: C:\Users\User\Documents\Javaua
            java -classpath C:\Users\User\Documents\Javaua\bin com.javaua.task.task02.task0202.Solution
            Process started (PID=2392) >>>
            Alina
            <<< Process finished (PID=2392). (Exit code 0)
            ================ READY ================

            CD: C:\Users\User\Documents\Javaua
            Current directory: C:\Users\User\Documents\Javaua
            java -classpath C:\Users\User\Documents\Javaua\bin com/.Solution
            Process started (PID=7120) >>>
            Error: Could not find or load main class com/.Solution
            <<< Process finished (PID=7120). (Exit code 1)
            ================ READY ================

            I don’t know how to write “com / ** / *. Solution” correctly

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

              @mykola-biloshytskyi said in does not open folders! How to open a file without specifying the entire path?:

              com / ** / *. Solution

              Easy enough: do exactly what I told you: paste in the text, then highlight it, then click on the big </> button on the post editor. This is detailed in the FAQ I linked you to.

              ```
              com / ** / *. Solution
              ```
              

              will be rendered as

              com / ** / *. Solution
              

              If you just pasted in the examples, selected them, and hit that button, it would have worked.

              I think you have a Java problem – ie, that you don’t know how to send the right command line arguments to the java executable; and I think you should contact a java forum for help with that. If you disagree with me, then you need to show three things:

              1. A capture of the text from a working run from a standard command line window (cmd.exe or powershell)
              2. A capture of the text of the NppExec script you are using
              3. A capture of the output in the NppExec console when you run the script from #2.

              You could use the following as a template:

              Here are the outputs you requested:
              1. command line window
              ```
              c:\> java -classpath c:\...
              ```
              2. NppExec script:
              ```
              NPP_SAVE
              cd "$(CURRENT_DIRECTORY)"
              javac "$(FILE_NAME)"
              java -classpath "$(CURRENT_DIRECTORY)" "$(NAME_PART)"
              ```
              3. NppEcec console output:
              ```
              NPP_SAVE: C:\usr\local\scripts\comets.keepalive.pl
              CD: C:\usr\local\scripts
              Current directory: C:\usr\local\scripts
              javac "file"
              ...
              java -classpath "path" "file"
              ...
              ```
              

              (except you would put in your actual values, instead of my dummy values)

              This would render as
              Here are the outputs you requested:

              1. command line window
              c:\> java -classpath c:\...
              
              1. NppExec script:
              NPP_SAVE
              cd "$(CURRENT_DIRECTORY)"
              javac "$(FILE_NAME)"
              java -classpath "$(CURRENT_DIRECTORY)" "$(NAME_PART)"
              
              1. NppEcec console output:
              NPP_SAVE: C:\usr\local\scripts\comets.keepalive.pl
              CD: C:\usr\local\scripts
              Current directory: C:\usr\local\scripts
              javac "file"
              ...
              java -classpath "path" "file"
              ...
              

              Now, if you want help, use the template I just provided, and paste in your values.

              Mykola BiloshytskyiM 1 Reply Last reply Reply Quote 0
              • Mykola BiloshytskyiM
                Mykola Biloshytskyi @PeterJones
                last edited by

                C:\Users\User\Documents\Javaua>java -classpath C:\Users\User\Documents\Javaua\bi
                n com.javaua.task.task02.task0202.Solution
                Alina

                C:\Users\User\Documents\Javaua>java -classpath C:\Users\User\Documents\Javaua\bi
                n com/ ** / * . Solution
                Error: Could not find or load main class com.

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

                  @mykola-biloshytskyi ,

                  So you completely ignored everything I told you – you did not use the template I gave you, you did not use the formatting buttons, you did not response to all three questions.

                  However, it doesn’t matter. The command-line data that you showed proves that the problem is not with Notepad++ or with the plugin NppExec. The problem is with the syntax you are using on the command line – because you are getting the same error there that you did in NppExec. Your question is thus a Java question, not a Notepad++ or NppExec question.

                  You are going to have to find a Java forum and ask your question there.

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