The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2001



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.



Posted by Matt Gerrans on November 18, 2001 at 4:54 PM

Actually, I was confused that you changed the source code. If you just run the original, you can type whatever target string you want for exec() on the command line or in the TextField of the GUI.

- mfg

> > Hi I have two questions. One is regarding java.awt vs javax.swing - what is the difference between the two and when would each be used? Because don't both of them have classes to create a graphical user interface? My second question is regarding Runtime.getRuntime().exec(cmd) - what is considered 'legal' commands that exec will execute? Because I executed Matt's code (The best way to use Runtime.exec() (on Windows, that is)) and a command like 'start "c:\music\a - d.mp3"' (w/o the apostrophe) seems to execute (Winamp opens up and starts playing a - d.mp3), but when I try to execute
> >

> > String cmd = "start \"c:\\music\\a - d.mp3\"";
> > Runtime.getRuntime().exec(cmd);
> >

> > Winamp doesn't start up. Does anyone know what is wrong? Thnx in advance for the help.
> > Hiran

> The problem was that I had forgot to declare my main method as static, and the output window was closing faster than I could read the error message that was generated. I feel dumb now...but whatever.
> Hiran


Sponsored Links

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