Pierre D
Pierre D

Reputation: 26201

Eclipse debug configurations, program arguments woes

I have a java program that takes a bunch of arguments. One of these arguments is meant to be a file glob that I wish to give to the program without interpolation (as is).

For example: s3sync -match '*.xml{,.gz}' ...

This works perfectly fine from the command line. s3sync itself is a minimal shell script that sets up some environment vars and finally does:

$EXEC java $DEBUG $MEMORY -cp "$CLASSPATH" com.my.packages.S3Sync "$@"

However, when I try my code from an Eclipse Debug Configuration, I'm unable to tell Eclipse NOT to interpolate that arg. Here is what I tried, and what comes in as String[] args in main():

in Program Arguments     what it becomes in main(String[] args)
-match '*.xml'           String[]{"-match", "'*.xml'"}
-match *.xml             String[]{"-match", "build.xml", "ivy.xml", ...}
-match "*.xml"           String[]{"-match", "build.xml", "ivy.xml", ...}
-match \*.xml            String[]{"-match", "\\*.xml"}

Any idea? How do I write an argument in Eclipse Debug Configurations > Program Arguments so that the arg[] is "*.xml"?

Upvotes: 1

Views: 637

Answers (1)

Chris Gerken
Chris Gerken

Reputation: 16392

This dialog has been problematic for this and similar reasons.

The only character you can escape in that dialog is the double quote character. You could try escaping the double quotes in

-match \"*.xml\"

and see if you can get the "*.xml" passed in correctly, albeit with quotes on it.

Other than that, I think you'll have to support an alternate syntax that you translate into the correct syntax in your code.

Upvotes: 1

Related Questions