Specifying Command-Line Arguments in jGrasp

This is a step-by-step guide showing how to specify command-line arguments in jGrasp.

Step 1: Enable Command-Line Arguments

Go to Build -> Run Arguments, which is a checkbox you'll need to select. An illustrative screenshot is provided below.

Step 2: Provide Command-Line Argumemts

After selecting “Run Arguments” in the previous step, a new area will appear in jGrasp where you can type in your command-line arguments. The position of this area is shown in the screenshot below.

In this area, you can type in your command-line arguments. Each argument is separated by whitespace (e.g., a space). An example is shown in the screenshot below, where three arguments have been provided, namely:

  1. foo
  2. bar
  3. baz

The screenshot above also shows what happens if the given program is run with these arguments, shown in the lower red box. As shown, the arguments are passed directly to the program via the command-line:

java PrintFirstThreeArgs foo bar baz

Because the shown program merely prints out the first three arguments it receives, this program produces as output:

foo
bar
baz

...since the given arguments were foo, bar, and baz, respectively.