The Artima Developer Community
Sponsored Link

Java Answers Forum
using Runtime class on Windows platform

1 reply on 1 page. Most recent reply: Mar 17, 2003 2:31 AM by Jiri Fabian

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
sowmya

Posts: 1
Nickname: newby
Registered: Mar, 2003

using Runtime class on Windows platform Posted: Mar 14, 2003 1:59 PM
Reply to this message Reply
Advertisement
Hi,

I have a JRE in Windows and am trying to do the following:

Runtime run = Runtime.getRuntime();
String[] cmd = {"ping", "10.10.10.1"};
run.exec(cmd);


I am able to do the ping from the cmd window. When I run this Java program, the DOS window opens and just hangs. It seems like it invoked the ping.exe and just hangs. I also tried setting the environment by including the Path etc..but still doesnt work.

Any help is greatly appreciated..

Thanks
Newby


Jiri Fabian

Posts: 11
Nickname: filemon
Registered: Mar, 2003

Re: using Runtime class on Windows platform Posted: Mar 17, 2003 2:31 AM
Reply to this message Reply
Works4me on 1.4 ,Win XP.

From java.lang.Process javadoc
<pre>
The Runtime.exec methods may not work well for special processes on certain native platforms, such as native windowing processes, daemon processes, Win16/DOS processes on Win32, or shell scripts. The created subprocess does not have its own terminal or console.
</pre>

Try to invoke Process.getInputStream() on created process to get more info.

Process proc = run.exec(cmd);
proc.getInputStream();

fil

Flat View: This topic has 1 reply on 1 page
Topic: banking system-please help! Previous Topic   Next Topic Topic: mail merging

Sponsored Links



Google
  Web Artima.com   

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