wood burning stoves 2.0*
The moose likes Java in General and the fly likes How to send command line arguemenst as a String from eclipse to Command prompt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to send command line arguemenst as a String from eclipse to Command prompt" Watch "How to send command line arguemenst as a String from eclipse to Command prompt" New topic
Author

How to send command line arguemenst as a String from eclipse to Command prompt

Iqbal Jamadar
Greenhorn

Joined: May 01, 2013
Posts: 2
HI all,

I am writing a code.

Hera I am executing a command from Eclipse, Command is

java com.tmo.fmatoerp.migration.MigrationUtil "+object_type+" "+ "\""+whereclause+"\""

I have to send two command line arguments, Whereclause is having DQL(SQL) , It should go as a string to the command prompt But I am not able to send it as string.


please some body help me. Thanks in advance
Mansukhdeep Thind
Ranch Hand

Joined: Jul 27, 2010
Posts: 1157

Welcome to the ranch Iqbal.

Not sure I understand your question, what are you trying to execute, a java class file from eclipse, and you want to send String args[] to it is it? Can you clarify?


~ Mansukh
Iqbal Jamadar
Greenhorn

Joined: May 01, 2013
Posts: 2
Hi Mansukhdeep,

Thanku for reply.

I am trying to exicute below command line using Java(In Eclipse).
"java com.tmo.fmatoerp.migration.MigrationUtil "+object_type+" "+""+whereclause+"")

Here
object_type =tmo_erp_receipt and
Whereclause=r_creation_date>=DATE('02/01/2013 00:00:00','mm/dd/yyyy hh:mm:ss')AND r_creation_date<=DATE('02/31/2012 24:00:00','mm/dd/yyyy hh:mm:ss') and r_object_type ='tmo_receipt_doc'and subject !='Migrated' and a_content_type ='pdf' ENABLE(RETURN_TOP 100)

If I send Whereclause as it is then it is saying as specified path not found because I am sending date over here.
I checked directly running it from command prompt with " ", it is working fine.
So If I am able to send whereclause Like this "r_creation_date>=DATE('02/01/2013 00:00:00','mm/dd/yyyy hh:mm:ss')AND r_creation_date<=DATE('02/31/2012 24:00:00','mm/dd/yyyy hh:mm:ss') and r_object_type ='tmo_receipt_doc'and subject !='Migrated' and a_content_type ='pdf' ENABLE(RETURN_TOP 100)" ie in double quotation marks, then my issue will be solved.


I used escape characters also not working.




Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38472
    
  23
Project‑Run As‑Run configurations‑Command line arguments

Or something similar.
surlac surlacovich
Ranch Hand

Joined: Mar 12, 2013
Posts: 296

Use back-slash (\) to escape double quotes then:

 
jQuery in Action, 2nd edition
 
subject: How to send command line arguemenst as a String from eclipse to Command prompt