Discussions

EJB programming & troubleshooting: Running external app thro' Java

  1. Running external app thro' Java (1 messages)

    I am using Runtime.exec api as follows


    Runtime re = Runtime.getRuntime();
    Process p = re.exec("C:
    Notify.exe");

    The exe is getting called, but it executes in the calling directory instead of target directory.

    I need to set the working directory as c:
    some_dir.

    Any/all help appericiated.

    Thanks


  2. Running external app thro' Java[ Go to top ]

    You need to explicitly set the working directory in a props file, and use the following constructor for the exec method:

    public Process exec(String cmd,
                        String[] envp)
                 throws IOException

    [This only applies to Java 1.3 +]

    - regards,

    john