Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Without KeyBoard input assiging value to local variable  RSS feed

 
SunilRee Gupta
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java file: ConsoleInputReader.java which is prompting us for key Input.Our requirement is that we can not modify this file as you can think as
venodor specific file.

our requirement is that using batch file or ant file or any other means without modifying this java file we have to print the name variable of this java file


import java.io.*;

public class ConsoleInputReader
{
public static void main(String[] args) throws Exception
{
inputProcess();
}

static void inputProcess() throws Exception
{
System.out.println("Please Enter your name");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String name = br.readLine();
System.out.println("Your Name is "+ name);
}
}

Awaiting for reply.

Thanks and Regards
Sunil
 
sanjeev mehra
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can u pls. try to explain your problem again?
 
SunilRee Gupta
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Our Requirement is
1) we have to use same java file i e constraint
2) we have to give input through batch file or ant file or any other means ie we can write our file in different package which can extend this file but the java file I have mentioned above we can not modify single word.

thanks and Regards
Sunil
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, this isn't a Java question. At least not if I understand it right. If you want the input to come from the batch file -- the shell -- then you use shell commands that do that. For example you could have input come from some other file:Or you could echo it directly from the batch file something like this (I'm assuming you're using Windows here as Unix people would be quite likely to know this sort of thing already):I'm sure there are other ways, too.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!