How to give command line arguments in eclipse

Wednesday, March 14, 2012

It's simple,
Create a test programe on eclipse IDE.

public class NameArguments {
public static void main(String[] args) {
System.out.println("First Name " + args[0]);
System.out.println("Last Name " + args[1]);

Goto: Run->Run Configurations

in that window select Arguments tab and give the arguments(only the arguments)
Notice that there is at least one space between every two arguments.
Then just click Apply

execute the code.
output would be

First Name Pradeep
Last Name Rathnayaka


  © Blogger template Writer's Blog by 2008

Back to TOP