Command Line Arguments

I cannot seem to find how to add command line arguments in IntelliJ. Here is my code:

public class BlankFiller {     public static void main(String[] arguments) {         System.out.println("The " + arguments[0] + " " + arguments[1] + " fox " + "jumped over the " + arguments[2] + " dog.");     } }



I need to be able to specify these arguments. I have tried doing ALT + SHIFT + F10, going to edit, and adding my arguments in the "Program Arguments" section with no luck. I am just starting with IntelliJ, and have previously used DrJava, where there was an interactions pane and I could specify them using

java BlankFiller arg arg arg

How can I do this in IntelliJ? Thanks!

P.S. Please be noob friendly in responses! Thanks again!
7 comments

Hi David,

That 'Program Arguments' section is the right place. Please provide a screenshot which shows what do you have there.

Denis

0

Edit: nevermind i will post in one sec.

0

It looks ok for me. Could you try execute your program with the following code as the first main() instruction and provide the output here:

System.out.println(Arrays.toString(args));


Denis
0

I get the following error:

java: cannot find symbol
  symbol:   variable Arrays
  location: class BlankFiller

0

That 'Arrays' is 'java.util.Arrays'

Denis

0

Please sign in to leave a comment.