The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
October 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

So...what would be the best way?

Posted by Hiran on October 27, 2001 at 10:41 PM

> > > Actually Chin, it is not that simple using Runtime.exec() does not behave like running the commands from command prompt. There is a fair bit of mystery behind Runtime.exec().

> What do you mean? For the most part, it is like running the exec() or system() of other APIs, isn't it? Seems to work okay. Using the system(), WinExec(), CreateProcess(), ShellExecute(), exec(), pexec() in C/C++, Delphi, Python, etc. all have the usual caveats, especially when launching console or 16-bit (on Win32 platform) apps whose "window" you wish to control in some way.

> I was going to mention that on the windows platform, you should use the environment variable %comspec%, not cmd.exe or command.com, since it is not always guaranteed that these are in the path and there are many variations with Win95/8/Me/NT/XP, etc. However, I see that System.getenv(), is not only deprecated, but also not available, so I don't know how you'd get that variable (it is not among the "replacement" System.getProperty()'s properties).

> - mfg

So...how exactly should I call a program like Winamp and pass it a file to play? Should I use the the method shown in that URL (http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html)?
Hiran





Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us