hello friends,

I have a file _ant_compile.cmd which i need executed from a java program, here I have two questions to resolve,

1. when I try the method attached in the file, the program launches in the same window, and halts without proceeding
but when I use the second method the program starts to execute properly, but it opens itself in a separate window??

why is the first method halting ??

2.once the program starts, the program outputs a question and requires either a "Y" or "N" from m, I wish to avoid this part by passing some parameter which either answers this when this is fired or either prevents this question from popping up...this I do because I do not have access to change anything in the _ant_compile.cmd file. is there a way for me to accomplish this??

(I have attached attached necessary files)
Thanks friends.

///////////////////////////////////////1 st method///////////////////////////////
public void Compile(String path){

try {
                Runtime rt = Runtime.getRuntime();
                //Process pr = rt.exec(path);
                Process pr = rt.exec(path);

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

                String line=null;

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

                int exitVal = pr.waitFor();
                System.out.println("Exited with error code "+exitVal);

            } catch(Exception e) {
  }          }

////////////////////////////////2 nd method//////////////////////////////////

public void Compile(String path){

try {
      String line;
      File file=new File(path);
     // String fpath=file.getAbsolutePath();
     // String [] patharray={fpath,"RUN=Y"};
      Runtime.getRuntime().exec  ("rundll32 SHELL32.DLL,ShellExec_RunDLL " +file.getAbsolutePath());
     // p.waitFor();
    catch (Exception err) {
7 Years
Discussion Span
Last Post by NormR1

Can you post a complete program that compiles and executes that demonstrates the problem?

It would be useful if you included your comments in the code describing your problem instead of having the comments in one place and the code in another.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.