Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization 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: 4565
8
  • 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: 4565
8
  • 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
Posts: 48415
56
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic