Thursday, March 3, 2011

How to make Eclipse prompt me for command line arguments

I know I can configure command line arguments in the Run configuration but I want to run a java file multiple times with different command line arguments. It's a pain to change the Run Configuration every time.

Is there a way I can make Eclipse prompt me for command line arguments every time I run the program?

From stackoverflow
  • Add string_prompt as a Program Argument in the Run configuration.

     ${string_prompt}
    

    There are also a file_prompt and a folder_prompt if you want specifically files\folders.

    These are available through the Variables button on the (x)= Arguments tab of the Run Configuration dialog.

  • In addition you can add a string to the prompt by using ${string_prompt:My Prompt Text} which will show the dialog box with 'Please input a value for My Prompt Text'.

  • I used this ${string_prompt} thing for a while now, but I wonder if anybody has the same problem as me : the prompt always appears twice, one time with teh custom text (like bigcmos said), and one time without. Did anybody has ever meet this problem ?

0 comments:

Post a Comment