File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes quotes that I want in arguments to main Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "quotes that I want in arguments to main" Watch "quotes that I want in arguments to main" New topic

quotes that I want in arguments to main

Dan Walin
Ranch Hand

Joined: Nov 11, 2003
Posts: 109
I am passing arguments to main that include quotes. I WANT the quotes to be passed to main but they seem to disappear (get stripped out). The argument I'm passing is:

<?xml version= "1.0" encoding="UTF-8" ?> <cmrequestor> <CCNoteId>A80XDT </CCNoteId> <CCCaseid>002595062</CCCaseid> <CCProcessTime>2005-03-22 15:52</CCProcessTime>

But when main gets the arguments, they look like this (quotes are missing):

<?xml version= 1.0 encoding= UTF-8 ?> <cmrequestor> <CCNoteId>A80XDT </CCNoteId> <CCCaseid>002595062</CCCaseid> <CCProcessTime>2005-03-22 15:52</CCProcessTime>

Is there any way I can ensure the quotes are kept? Actually, as I'm writing this I just thought about escape characters. Maybe there is an escape sequence \" or "" or something like that?
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Yes there are escape sequences. Not sure if they work in main though. Good Luck


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
John Dell'Oso
Ranch Hand

Joined: Apr 08, 2004
Posts: 130
Yes, escaping does work in main - so if you wanted to print out "Hello World" (with the quotes) you would pass the argument like so:

java HelloWorld "\"Hello World\""

I agree. Here's the link:
subject: quotes that I want in arguments to main
It's not a secret anymore!