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
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

"Program.launch" but with command-line arguments

Mariano Lopez-Gappa

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

Joined: Jan 28, 2003
Posts: 4181

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

Mariano Lopez-Gappa

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?
I agree. Here's the link:
subject: "Program.launch" but with command-line arguments
It's not a secret anymore!