Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I know, the question is a bit vague .. but I have the following problem
have this DOS .cmf file, which calls some Java code, an this Java code asks some runtime questions .. now, normally, with regular DOS commands, you can always fill in some sort of question file, and then redirect input, like this:
my_program.bat X my_answers.txt
(the X is the smaller-than sign .. cant get it to display here)
problem now: because of the Java code, it doesnt seem to work ..
he can accept the answers which have a default, but not the ones without ...
anybody ?

I just ran the following program from the command prompt by directing i.txt into the program and directing the output to o.txt...
import java.io.*;class Hello {
public static void main (String args []) { // main program
String userName="";
System.out.print("Enter your name: ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
userName = br.readLine();
} catch (IOException ioe) {
System.out.println("IO error trying to read your name!");
System.exit(1);
}
System.out.println("Thanks for the name, " + userName);
}
}//Just ran it using this
C:\>java Hello < i.txt > o.txti.txt contained a name followed by a newline character.

![]() |
Setting up an Apache serv...
|
Need Help...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |