3

When running a program via Eclipse is it possible to provide command like arguments to be stored in the String[] args as you can on the command line?

Tim
  • 1,056
  • 4
  • 17
  • 34
  • Related question: http://stackoverflow.com/questions/373328/invoking-java-main-method-with-parameters-from-eclipse – Don Roby May 02 '12 at 16:43

6 Answers6

4

Just specify those arguments in the Run configuration (Arguments tab) menu of your project.

talnicolas
  • 13,885
  • 7
  • 36
  • 56
4

Yes.

If you click on the arrow next to the "Run" button, you can open the Run Configurations menu. You can specify both Program Arguments (which are passed into the args[] parameter to your main method) as well as VM Arguments.

Thomas Owens
  • 114,398
  • 98
  • 311
  • 431
3

Yes. You can specify it as part of the run configuration for a project

Johm Don
  • 609
  • 2
  • 5
  • 15
3

Yes. Click on Run - Run configurations... Then select your run configuration, select the Arguments tab, and enter arguments in the Arguments text area.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
2

Yes. The easiest way is to right-click on the class you want to run and select

Run As->Run Configurations

There is a tab to add arguments.

Martin
  • 7,089
  • 3
  • 28
  • 43
1

In Run configuuration you can give it here at this location.

enter image description here

Ketan Bhavsar
  • 5,338
  • 9
  • 38
  • 69