command line : Java Glossary
home C words local find no local find frame, full screen Google search web for topic jump to footer translate with Babelfish by Roedy Green ©1996-2008 Canadian Mind Products
Go to : punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all)
command line
The command you use to start a program typed on the OS command line. In java most commonly you invoke javac.exe, java.exe, ant.bat, jar.exe, jarsigner.exe, keytool.exe.

Awkward Characters On the Windows Command Line

In Windows, it you need to take special actions to pass the following characters to a program as parameters on the command line.
Awkward Characters on the Windows Command Line
Character Special Meaning How to pass it through to the program
space separates parameters enclose the whole parameter in quotes "
< input redirection enclose the whole parameter in quotes "
> output redirection enclose the whole parameter in quotes ". In both cmd.exe and TakeCommand, if preceeded by \", this is still interpreted as redirection. I have reported this bug, fully expecting the authors to explain it is a feature.
| pipe enclose the whole parameter in quotes "
& command joiner enclose the whole parameter in quotes "
' tick enclose the whole parameter in quotes "
" parameter delimiter write it as \" and enclose the whole parameter in quotes ". I suspect this behaviour comes from Java, not the command interpreter.
% macro replace write it as %%. In Take Command, you also have the option of surrounding the parameter in back quotes (grave `) `%alone`.

Awkward Characters on the Linux Command Line

If you are using Linux bash, or other Bourne compatible or csh compatible shell, enclose your regex in single quotes, '…'. Then the only character you need to worry about inside the regex is ' itself which needs to be encoded as '\'' i.e. apos, backslash, apos, apos. This seems rather long winded. What you are doing is ending the string, doing the quote (quoting it with \ much as you would in Java string literals), then starting it up again, concatenating all three pieces.

Troubleshooting Awkward Character Quoting problems

You can use the following test program to experiment with parameters. It will help you figure out how parameters for any program are getting mangled on their way through the command processor. Just pass the parameters for any other program to this one, and check to see if the quoting you did to the awkward characters succeeded in getting the desired characters through to the program unmolested.

CMP_homejump to top
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.16] The information on this page is for non-military use only.
You are visitor number 5,137. Military use includes use by defence contractors.
You can get a fresh copy of this page from: or possibly from your local J: drive (Java virtual drive/Mindprod website mirror)
http://mindprod.com/jgloss/commandline.html J:\mindprod\jgloss\commandline.html