| Author |
How to let user dynamically input parameter
|
cake naiyou
Greenhorn
Joined: Apr 29, 2011
Posts: 27
|
|
In my current program, the input information is hard coded. For instance
If I want to change title1 to title2, I have to modify the source code and click "run Java application" in Eclipse. How can I change the program to allow the user dynamically input the parameter after clcking "run Java application".
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
You expect your users to run your program in eclipse?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
John Jai
Bartender
Joined: May 31, 2011
Posts: 1778
|
|
Use Reader to read console input use or code Swing. Is this for an Eclipse enhancement requirement
|
 |
cake naiyou
Greenhorn
Joined: Apr 29, 2011
Posts: 27
|
|
The application should be command prompt one. At present, the debugging and testing process will be done in Eclipse.
Bear Bibeault wrote:You expect your users to run your program in eclipse?
|
 |
John Jai
Bartender
Joined: May 31, 2011
Posts: 1778
|
|
Ok then read user input on cmd prompt using reader
|
 |
Greg Brannon
Bartender
Joined: Oct 24, 2010
Posts: 530
|
|
|
Alternately, allow the user to specify the input information in a command line parameter.
|
Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795
|
 |
Abhay Agarwal
Ranch Hand
Joined: Feb 29, 2008
Posts: 696
|
|
if it is a stand alone program (which uses public static void main(String[] args)) then you can use pass arguments at runtime.
If you compile and run this class as
then 'qwerty' will printed by
line
~ abhay
|
Oracle certified Java 7 Programmer, SCJA 1.0, SCJP 5.0, SCWCD 5.0, Oracle SQL Fundamentals I
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32701
|
|
|
You can use a command-line argument, or the Scanner class is much easier to use than a Reader for keyboard input.
|
 |
 |
|
|
subject: How to let user dynamically input parameter
|
|
|