command line : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

command line

The command you use to start a program typed on the OS (Operating System) command line. In java most commonly you invoke javac.exe, java.exe, ant.bat, jar.exe, jarsigner.exe, keytool.exe.

You can find out what encoding is being used in the command line box. Right click in the upper right corner in the black space and select properties. For historical reasons, it might well be 850 OEM (Original Equipment Manufacturer) Multilingual Latin 1

Awkward Characters On the Windows Command Line

Deal with awkward characters in the Windows command line like this:

  • Enclose parms with embedded spaces or other awkward characters, in ".
  • Encode an embedded " as \".
  • Don’t do anything special with embedded \ in filename parms.
  • To get \\ you need to code \\\\.
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
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

This page is posted
on the web at:

http://mindprod.com/jgloss/commandline.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\commandline.html
logo
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[54.242.9.97]
You are visitor number