This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark ""Program.launch" but with command-line arguments" Watch ""Program.launch" but with command-line arguments" New topic
Author

"Program.launch" but with command-line arguments

Mariano Lopez-Gappa
Greenhorn

Joined: Mar 28, 2009
Posts: 13


This won't work. Javadoc clearly implies the argument should hold the file to be opened by the program. I need to give the program that /add modifier in order for it to "enqueue" the playlist instead of just playing it. Also this isn't media-player-independent but I don't think there is a standard on enqueuing files. If there is, I'm all ears!

Thanks guys!


PS: I should be able to use Runtime then exec right? But since I don't really know which media player I'm looking for, I must resort to Program.findProgram and it yields a Program object which I can't use with this...
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4180
    
  21

There is not a 'Program' type in the core JRE. Where did you get this class?


Steve
Mariano Lopez-Gappa
Greenhorn

Joined: Mar 28, 2009
Posts: 13
Yes sorry it's in the SWT framework.

Anyway, I got it to work via getRuntime().exec() but I'm assuming the client is using Winamp and also that he installed in the program files default location (default from there on, since I'm using getEnv for Programfiles), otherwise it won't work.

This solution is working but it's not optimal Looking at registry for the Winamp path would be even worse since then it wouldn't even be platform independent. It should be platform-independent and also media-player-independent.

Any clues?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: "Program.launch" but with command-line arguments