The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 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:

Found the answer to the Runtime question (in case anyone is still following this thread)

Posted by Hiran on November 18, 2001 at 12:54 AM

> 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



Replies:

Sponsored Links



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