command line : Java Glossary

go to home page C words local find full screen, hide local find menu Google search web for more information on this topic jump to foot of page translate this page with Babelfish 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) ©1996-2009 Roedy Green, Canadian Mind Products
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.
ant.bat
Jar.exe
jarsigner.exe
java.exe
javac.exe
KeyTool IUI: third party GUI version of keytool
keytool.exe
main: passing parameters to main

CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/commandline.html J:\mindprod\jgloss\commandline.html
CMP logofeedback Please email your feedback for publication, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.191.105]
You are visitor number 8,235.