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 ================ -
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.
-
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) -
@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
-
@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:
- A capture of the text from a working run from a standard command line window (cmd.exe or powershell)
- A capture of the text of the NppExec script you are using
- 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:- command line window
c:\> java -classpath c:\...
- NppExec script:
NPP_SAVE cd "$(CURRENT_DIRECTORY)" javac "$(FILE_NAME)" java -classpath "$(CURRENT_DIRECTORY)" "$(NAME_PART)"
- 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.
-
C:\Users\User\Documents\Javaua>java -classpath C:\Users\User\Documents\Javaua\bi
n com.javaua.task.task02.task0202.Solution
AlinaC:\Users\User\Documents\Javaua>java -classpath C:\Users\User\Documents\Javaua\bi
n com/ ** / * . Solution
Error: Could not find or load main class com. -
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.