Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Iqbal Jamadar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1158
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Iqbal Jamadar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 49411
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Project‑Run As‑Run configurations‑Command line arguments

Or something similar.
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use back-slash (\) to escape double quotes then:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic