aspose file tools*
The moose likes Java in General and the fly likes telnet in Win2000/XP using java runtime.exec ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "telnet in Win2000/XP using java runtime.exec ??" Watch "telnet in Win2000/XP using java runtime.exec ??" New topic
Author

telnet in Win2000/XP using java runtime.exec ??

Prithvi Raj
Greenhorn

Joined: Jul 13, 2001
Posts: 9
i need to start the telnet session from java . the following code works fine in 98/ nt 4.0 but it does not work in win2k/XP . if returns an exitvalue of -1 thats all. can any one tell me why . is it because the telnet program in these environments seem to work differently because they do not open the window as in 98 or NT 4.0 . any work arounds
Process p = Runtime.getRuntime().exec("telnet");
BufferedReader br = new BufferedReader(new
InputStreamReader(p.getInputStream()));
BufferedWriter bw = new BufferedWriter(new
OutputStreamWriter(p.getOutputStream()));
bw.write("1");
bw.flush();
String line;
while ((line = br.readLine()) != null)
{
System.out.println(line);
}
br.close();
bw.close();
System.out.println(p.exitValue());


prithvi
Jason Ford
Ranch Hand

Joined: Aug 02, 2001
Posts: 54
This question was first asked here. :roll: Please don't crosspost.


SCJP, SCWCD
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Indeed. This topic is closed.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: telnet in Win2000/XP using java runtime.exec ??