This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes General Computing and the fly likes how to handle space between C:\Document and Setting\ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "how to handle space between C:\Document and Setting\" Watch "how to handle space between C:\Document and Setting\" New topic
Author

how to handle space between C:\Document and Setting\

Kee Kee moon
Ranch Hand

Joined: Dec 11, 2009
Posts: 147
No, it is not just a windows command. I pass the argument into eclipse IDE window and I do use double quote. When the argument comes to the java program,
I still get errors. Apparently, the space cause the problem.

Thanks a lot.



Hi,

Please help.

I pass the argument C:\Document and Setting\...... I expect my java program to execute jar tf C:\Document and Setting\xxx\xxx\xxx.jar
However, there are spaces between C:\Document and Setting\.... and it fails to get the results.

How to resolve the issue?
Thanks in advance.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

This is a question about the Windows command line, not about Java. And in that shell, if you want a string which contains spaces to be treated as a single unit, you surround it by "quotes".
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Don't edit your question after people have answered it, it makes the answers to the original question look foolish.

As I don't like being made to look foolish, I leave it to other people to see if they dare to answer the new version of the question.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Try:

jar tf "C:\Document and Setting\xxx\xxx\xxx.jar"

like Paul said in his first response to your post.


JBoss In Action
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to handle space between C:\Document and Setting\
 
Similar Threads
the argument C:\Document and Setting\
JAVA_HOME variable is not working properly in bat file
JAVA_HOME variable is not working correctrly in batch file.
How to set virtual arguments in servlet
JAVA_HOME variable in batch file is not working properly