The Artima Developer Community
Sponsored Link

Java Answers Forum
Runtime.getRuntime.exec()

1 reply on 1 page. Most recent reply: Jun 27, 2002 4:36 PM by Thomas SMETS

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Ying Liu

Posts: 2
Nickname: yl
Registered: Jun, 2002

Runtime.getRuntime.exec() Posted: Jun 27, 2002 5:43 AM
Reply to this message Reply
Advertisement
Hi,

I have a question about Runtime.getRuntime().exec(). Please help me.

I want to pass in a command. The command is "cmd.exe /c C:\\executables\\blastall -p blastn -d ecoli -i test.txt";

(C:\executables\blastall is an executable code, -p to pass the program, -d to pass the database, -i to pass the input file)

But it always has error. The DOS window can appear. But it says "Abrupt = 0"

The code is below. Thnaks.

public void test()
{

String cmdLine = "cmd.exe /c C:\\executables\\blastall -p blastn -d ecoli -i test.txt";

String line = "";

try

{

java.lang.Process djProc = Runtime.getRuntime().exec(cmdLine);

djProc.waitFor();

BufferedReader input = new BufferedReader(new InputStreamReader(djProc.getInputStream()));

while ((line = input.readLine()) != null) {

System.out.println(line);

}

System.out.println("in Here");

}

catch (Exception e)

{

System.out.println(e.toString());

}
}


Thomas SMETS

Posts: 307
Nickname: tsmets
Registered: Apr, 2002

Re: Runtime.getRuntime.exec() Posted: Jun 27, 2002 4:36 PM
Reply to this message Reply
Try to give this as argument :
String[] cmdLine 
  = new String[] {
                   "cmd.exe",
                   "/c",
                   "C:\\executables\\blastall",
                   "-p",
                   "blastn",
                   "-d",
                   "ecoli",
                   "-i",
                   "test.txt"
                   }; 


Thomas SMETS,
SCJP 2 - Brussels

Flat View: This topic has 1 reply on 1 page
Topic: Building reports Previous Topic   Next Topic Topic: java and mysql connexion

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use