Runtime - external program visibility  
Author Message
Oliver





PostPosted: 2005-3-1 17:44:00 Top

java-programmer, Runtime - external program visibility
Hello,

i use the getRuntime method to start an external program out of
my Java app: Runtime.getRuntime().exec(cmd);
where cmd is an array of String

String[] cmd =
{ "\"c:/Whatever.exe\"","/user=User","/password=XXX"};

Now the issue is that the program (Whatever.exe) starts, it
accepts the parameters (user,password), - the / is required by
Whatever.exe - but the window of the application Whatever.exe is
not visible! The process is there (one can see it in the
taskmanager).

In Delphi i have the possibility by using Windows.CreateProcess
and passing a "StartupInfo"
(lStartupInfo.dwFlags:= STARTF_USESHOWWINDOW;
lStartupInfo.wShowWindow:= SW_SHOWNORMAL;) but here in Java i dont see a possibility of determining in which way the external app is being started up or determining its visibility.

kind regards

Oliver
 
John McGrath [TeamB]





PostPosted: 2005-3-1 23:20:00 Top

java-programmer >> Runtime - external program visibility On 3/1/2005 at 4:43:50 AM, Oliver wrote:

> String[] cmd =
> { "\"c:/Whatever.exe\"","/user=User","/password=XXX"};

I am not sure if this is related to your problem, but the (\-quoted)
quotes in the first argument should not be there. Adding quotes with the
single string versions of the function would be appropriate, but not in
the String array versions, since the command is already tokenized. I am
somewhat surprised that the program runs at all with the quotes in the
command.

--
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
 
Oliver





PostPosted: 2005-3-4 21:48:00 Top

java-programmer >> Runtime - external program visibility
Hello,

thank you for the response.

i tried without the "\"s in the first string of the array. The behaviour is the same: the external program starts, but its window isnt visible. However, i can start a measurement in the external program, and then, the window appears. :) (The same is the case when an error message of the external program appears)So the process has been started correctly.

Now i use a workaround which isnt elegant, but it磗 working.
From my program i start a little Delphi application which in turn starts the external program up. :)

kind regards

Oliver

 
 
John McGrath [TeamB]





PostPosted: 2005-3-5 5:15:00 Top

java-programmer >> Runtime - external program visibility On 3/4/2005 at 8:48:28 AM, Oliver wrote:

> i tried without the "\"s in the first string of the array. The behaviour
> is the same: the external program starts, but its window isnt visible.
> However, i can start a measurement in the external program, and then,
> the window appears. :) (The same is the case when an error message of
> the external program appears)So the process has been started correctly.

It sounds to me like there is something odd about the program that is
causing this. Have you tried launching a different program, to see if
it launches properly?

--
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
 
 
Alexey N. Solofnenko





PostPosted: 2005-3-5 8:18:00 Top

java-programmer >> Runtime - external program visibility In Java you need to pump (read in a separate thread) stdout and stderr,
because the child process will block if the streams buffer is full.

- Alexey.

Oliver wrote:
> Hello,
>
> i use the getRuntime method to start an external program out of
> my Java app: Runtime.getRuntime().exec(cmd);
> where cmd is an array of String
>
> String[] cmd =
> { "\"c:/Whatever.exe\"","/user=User","/password=XXX"};
>
> Now the issue is that the program (Whatever.exe) starts, it
> accepts the parameters (user,password), - the / is required by
> Whatever.exe - but the window of the application Whatever.exe is
> not visible! The process is there (one can see it in the
> taskmanager).
>
> In Delphi i have the possibility by using Windows.CreateProcess
> and passing a "StartupInfo"
> (lStartupInfo.dwFlags:= STARTF_USESHOWWINDOW;
> lStartupInfo.wShowWindow:= SW_SHOWNORMAL;) but here in Java i dont see a possibility of determining in which way the external app is being started up or determining its visibility.
>
> kind regards
>
> Oliver
 
 
Oliver





PostPosted: 2005-3-9 22:08:00 Top

java-programmer >> Runtime - external program visibility
Hello,

i have solved the problem in another way, i start a little Delphi app which in turn starts the External.exe app :)
It磗 not elegant, but it磗 working (and the window is immediately visible too).

thank you

Oliver

 
 
Alexey N. Solofnenko





PostPosted: 2005-3-10 11:17:00 Top

java-programmer >> Runtime - external program visibility We start programs from Java without any problems. So you can start some
Delphi program, but not the application itself. Do you read from child
process stdout and stderr in Java?

- Alexey.

Oliver wrote:
> Hello,
>
> i have solved the problem in another way, i start a little Delphi app which in turn starts the External.exe app :)
> It磗 not elegant, but it磗 working (and the window is immediately visible too).
>
> thank you
>
> Oliver
>