Results 1 to 11 of 11
Thread: Command Line Arguments
- 11-04-2008, 07:21 PM #1
Member
- Join Date
- Oct 2008
- Location
- Aberystwyth
- Posts
- 55
- Rep Power
- 0
Command Line Arguments
Hi all. I'm a new user to NetBeans. (I started using it about 2 hours ago)
I decided to give NetBeans a try as the latest version of Ubuntu came with it pre-installed. Now I've made many simple programs using it and I've even created a GUI application, however i came across a stumbling block when i couldn't figure out how to use command line arguments when running a compiled Java program. Is there a simple way to do this using NetBeans and if so could someone please kindly tell me how? :confused:
Thanks in advance, Nak.
- 11-04-2008, 08:50 PM #2
Project --> right-click --> Properties --> run --> Arguments
NetBeans does come with an extremely exhaustive help file, or didn't you know that?
db
- 11-05-2008, 04:02 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Yes, that help page content all what you need. Explain all the concepts nicely.
One thing you have to keep in mind. In NetBeans you cannot set arguments for a class, you have to do it for a project as db explain above. So be careful when you are dealing with command line arguments.
- 01-10-2009, 01:46 AM #4
Member
- Join Date
- Dec 2008
- Posts
- 1
- Rep Power
- 0
新加的空白文章3
这是新加的空白文章3,可以在ubb可视化编辑器中,添加和修改文章内容。
- 01-10-2009, 01:50 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Can you please ask your question in English. Other languages are not effective here. Please don't do this again.
- 02-02-2010, 11:38 PM #6
Member
- Join Date
- Feb 2010
- Posts
- 3
- Rep Power
- 0
Why are arguments at project level?
Why would you configure arguments at the project level? That makes no sense. If I go to "Run->Set Project Configuration->Customize" and enter the class and the arguments, and then "Run->Run File", the arguments are not recognized. That is very confusing.
- 02-03-2010, 03:11 PM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 02-03-2010, 04:51 PM #8
Member
- Join Date
- Feb 2010
- Posts
- 3
- Rep Power
- 0
Why are arguments at project level?
I'm new to the Java/NetBeans world, but in my view a project consists of a group of classes (programs). Since arguments are specific to each program, why would you have to specify them at the project level? If I skip Net Beans and just run a java program from the command line, I can just enter:
'java myprog.java arg1 arg2' and that works, correct? In NetBeans I can follow the rules and get it to work--the theory just makes no sense to me.
- 02-04-2010, 09:07 AM #9
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Netbeans needs to know what arguments you want passing to your app. Eclipse has a similar thing, though you can setup various run targets...I don't know if Netbeans allows you to do that. That means you can set up various different run configurations with different argument lists. Either way, though, these are defined at the project level.
Where would you define them?
- 02-04-2010, 03:41 PM #10
Member
- Join Date
- Feb 2010
- Posts
- 3
- Rep Power
- 0
This is probably my lack of understanding of the Java/NetBeans environment. When writing an application in a language such as C, it is considered desirable for each program to be as independent from the others as possible (modularity). Argument values are sent either in a call from one routine to another, or indicated on the command line. You would not set up their values in something that is globally accessible, such an an include file.
So in Net Beans I would think that an argument value would be restricted to the scope of one class, not defined for the scope of the entire project.
- 02-04-2010, 03:45 PM #11
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Similar Threads
-
command line args
By MarkWilson in forum NetBeansReplies: 3Last Post: 08-04-2008, 03:22 AM -
Printing command line arguments
By Java Tip in forum Java TipReplies: 0Last Post: 12-03-2007, 09:27 AM -
how to enable jcreator to accept command line arguments?
By Amateur1980 in forum JCreatorReplies: 1Last Post: 11-07-2007, 02:17 PM -
Unable to execute command line command in java
By LordSM in forum New To JavaReplies: 1Last Post: 08-08-2007, 12:23 AM -
Java Command Line Arguments In Eclipse IDE
By JavaForums in forum EclipseReplies: 0Last Post: 05-19-2007, 09:45 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks