I new in Java and NetBeans.
I would like to know, Â¿how do I send "command line" parameters to main method in NetBeans IDE 6?
follow these steps:
1. make sure your project is marked as main project (right click on your project | mark as main project)
2. select "customize..." in the combo box in the toolbar on top
3. finally put your program arguments into the Arguments field and press OK to safe your new (you may also create a new configuration if you like)
hope that helps
Just a comment, because I'm testing I have a project with 2 packages and many sources codes.
After I followed your steps, I was making a mistake ... I was running de File no the Project.
Now, I'm running the project, with the name of my code in the Main Class and it is working.
OK, I tried your advice, however it is not working.
I am attempting to pass an argument to main via the method you explained, but when I try to access args, I get an an ArrayIndexOutOfBoundsException
please try it again it will work. Just run the project with the green arrow on top of the IDE and not via context menu of your class containing the main method.
edit: i would upload an image but this forum category does not support file uploads :/
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.