This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NetBeans passing entry parameter for main

 
Bud Tippins
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to run a program from NetBeans that takes a parameter for main when the program first starts. How can I pass that parameter to NetBeans? I'm using "run" but do not see any way to pass it a parameter.

Any help greatly appreciated.

Thank you.

 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look in the project properties. There should be a place to set arguments for the java command (and compiler arguments as well, if you ever need them).
 
Bud Tippins
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the menu navigational path to get to 'project properties"?

Thank you.
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using Netbeans 6.9.1, and I can get to them by right-clicking on the project in the projects window and choosing "Properties" from the pop-up menu. Then look under the "Run" category.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49733
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this thread would sit better on our IDEs forum. Moving.
 
Bud Tippins
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I found it. Thank you. I populated it with a value and then ran and got the following error:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at practicestuff.PracticeStuff.main(PracticeStuff.java:7)
Java Result: 1

It seems like the jvm is not receiveing the parameter? Any help greatly appreciated.

Thank you.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic