Eclipse: use command line arguments in eclipse

Trabla: Eclipse: use command line arguments in eclipse


Eclipse IDE use command line arguments in eclipse - tutorial


Solving:

1. This errors you get if run without setting command line arguments
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0

Eclipse IDE use command line arguments in eclipse - tutorial screenshot 1


2. Click options button, near "Run" button - select "Run Configurations..."

Eclipse IDE use command line arguments in eclipse - tutorial screenshot 2


3. In "Run Confuguration" windows, select "Arguments" tab

Eclipse IDE use command line arguments in eclipse - tutorial screenshot 3

4. Type arguments in "Program arguments" text area.
Separate each argument by pressing Enter button.

Eclipse IDE use command line arguments in eclipse - tutorial screenshot 4


5. Press "Apply" button to save entered command line arguments.
Than click "Run" button to execute main method.

Eclipse IDE use command line arguments in eclipse - tutorial screenshot 5

6. Result - success. Hooray!!!
Now simply click "run" green button - entered arguments will be used.

Eclipse IDE use command line arguments in eclipse - tutorial screenshot 6



No comments:

Post a Comment