aspose file tools*
The moose likes Java in General and the fly likes Java app. sends Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java app. sends "CTRL+D" through output stream in linux os." Watch "Java app. sends "CTRL+D" through output stream in linux os." New topic
Author

Java app. sends "CTRL+D" through output stream in linux os.

Rakesh Kumar
Ranch Hand

Joined: May 30, 2006
Posts: 63
Hi dear all,
I ahve a java application which will execute linux commands through java code.But I have to send "CTRL+D" key to close one session in linux.My doubt is how we can hard code and send this CTRL+D code using java code?What is teh string for that ?

rakesh
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

Rakesh Kumar wrote:Hi dear all,
I ahve a java application which will execute linux commands through java code.But I have to send "CTRL+D" key to close one session in linux.My doubt is how we can hard code and send this CTRL+D code using java code?What is teh string for that ?



A control-D is a character with an ASCII value of 4.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Rakesh Kumar
Ranch Hand

Joined: May 30, 2006
Posts: 63
Dear friend , I have api to send linux connad in my java application as below

telnet.transpose("ls -lrt");
_response = telnet.expect(promptArr);

telnet.transpose("Ctrl+d");------------------------------------->?
_response = telnet.expect(promptArr);


'transpose ' methode we have to pass the linux command , then it will execute it.But my problem is whta is teh string for 'CTRL+D' to pass as i made red color.
Please help
Rakesh
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

Do you know how to create a character with the value of 4? Do you know how to append that character to your string?


try...



Henry
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

Rakesh Kumar wrote:urgent help required

Please EaseUp


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java app. sends "CTRL+D" through output stream in linux os.