Issue with Command Line arguments which got spaces in it

When you pass command line arguments with spaces, they are taken as space separated arguments, and are splitted on space. So, you don't actually have a single argument, but multiple arguments.

If you want to pass arguments with spaces, use quotes:

java classname "Apple Inc. 2013 Jul 05 395.00 Call"

This is not a Java issue per se. It's a shell issue, and applies to anything you invoke with such arguments. Your shell is splitting up the arguments and feeding them separately to the Java process.

You have to quote the arguments such that the shell doesn't split them up. e.g.

$ java  -cp ... "Apple Inc. 2013"

etc. See here for a longer discussion.


The arguments are handled by the shell , so any terminal settings should not affect this. You just need to have quoted argument and it should work.