File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Head First Android
this week in the
I/O and Streams
Facing problem with running external exe from my java code
Joined: Feb 12, 2006
Feb 14, 2006 07:34:00
I have to run the exe from
code for which I m using Runtime and Process classes. The exe runs in the following way on command prompt
C:/ myexe -j [now press enter]
input sentence ! [now press enter]
And after this exe gives the output.
So is there any way to achieve this programmatically in Java?
here is my java code
public static void main(
File F = new File("C:/Chasen.exe");
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("C:/chasen.exe");
in = proc.getInputStream();
br = new
int a = in.read();
String res = br.readLine();
res = br.readLine();
catch (Exception IOEx)
I am not able to pass the arguments to exe which consists of '[-j] [press enter key] [statemet !] [press enter key] [press enter key ]'
Thanks in advance
Joined: Mar 22, 2005
Feb 15, 2006 01:55:00
There are a number of pitfalls to be aware of when using Runtime.exec;
exlains how to avoid some of them.
Don't get me started about those stupid
subject: Facing problem with running external exe from my java code
Send a String to Server and server send it somewhere on network
no such element? eek!
how can i use shell32 in my java program
Java Runtime command syntax help
Reading a file from a directory.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015