Rajat Gupta
Rajat Gupta

Reputation: 26587

How can I provide inputs to a java application during run-time, through netbeans window?

How can I provide inputs to a java application during run-time, through netbeans window ? or through any dialog box ??

I know there is an option to add parameters through the project property window, but it does not help to add run-time inputs.

Upvotes: 2

Views: 1587

Answers (2)

lukastymo
lukastymo

Reputation: 26809

I don't know why you want to do this in "netbeans" but to java programs you can provide inputs in this ways:

  1. read file
  2. read standard input
  3. use swing components which read input
  4. to only debugging purpose: use debug mode and breakpoint to stop and change any variables

Upvotes: 0

Anurag
Anurag

Reputation: 733

Define an input stream like this:

BufferedReader b = new BufferedReader(new InputStreamReader(System.in)); //input buffer 

and then use it to take command-line input like this:

a=b.readLine();

Upvotes: 1

Related Questions