Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Run Single File" does not support CLI-Arguments with spaces #4622

Closed
nigjo opened this issue Sep 11, 2022 · 5 comments
Closed

"Run Single File" does not support CLI-Arguments with spaces #4622

nigjo opened this issue Sep 11, 2022 · 5 comments
Labels
Contribution welcome An issue or feature not currently being worked on, but a contribution would be welcomed! good first issue Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) kind:bug Bug report or fix
Milestone

Comments

@nigjo
Copy link
Contributor

nigjo commented Sep 11, 2022

Apache NetBeans version

Apache NetBeans 14

What happened

In the Properties window of a "runnable" java source file there is a setting for "Arguments". These arguments are handed over to the file when run as "single file". But this property does not handle spaces in arguments properly.

How to reproduce

Arguments=first second third

works good. in main the args array has 3 entries as expected

Arguments="A first argument" second "All good are three"

does not work as expected. args will have 8 entries.

Did this work correctly in an earlier version?

No / Don't know

Operating System

windows 10

JDK

jdk 11

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

No response

Are you willing to submit a pull request?

No

Code of Conduct

Yes

@nigjo nigjo added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Sep 11, 2022
@lkishalmi
Copy link
Contributor

What build system are you using?

@nigjo
Copy link
Contributor Author

nigjo commented Sep 11, 2022

There is no project involved. It's the Java 11+ feature to run a .java file from command line.

@mbien mbien added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) and removed needs:triage Requires attention from one of the committers labels Aug 10, 2023
@mbien
Copy link
Member

mbien commented Aug 10, 2023

public class NewJavaFile {
    public static void main(String args[]) {
        System.out.println("arguments:");
        for (String arg : args) {
            System.out.println("arg: "+arg);
        }
    }
}

expected:

$ java NewJavaFile.java "one two" three
arguments:
arg: one two
arg: three

in NB:
image

arguments:
arg: "one
arg: two"
arg: three

@mbien mbien added good first issue Contribution welcome An issue or feature not currently being worked on, but a contribution would be welcomed! labels Aug 10, 2023
@mbien
Copy link
Member

mbien commented Nov 19, 2023

I can't reproduce this anymore with NB 20.

the output for "one two" three is now:

arguments:
arg: one two
arg: three

Can someone confirm?

I am curious how this got fixed, might be the nb-javac update or something else :)
the attribute storage did not change between 19 and 20:

<attr name="single_file_run_arguments" stringvalue="&quot;one two&quot; three"/>

@mbien mbien added this to the NB20 milestone Nov 19, 2023
@mbien
Copy link
Member

mbien commented Nov 19, 2023

fixed by #6262, closing

@mbien mbien closed this as completed Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contribution welcome An issue or feature not currently being worked on, but a contribution would be welcomed! good first issue Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) kind:bug Bug report or fix
Projects
None yet
Development

No branches or pull requests

3 participants