jQuery in Action, 2nd edition*
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
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: 4167
    
  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?
 
jQuery in Action, 2nd edition
 
subject: "Program.launch" but with command-line arguments
 
Similar Threads
Playing audio and Video Files
how to open a file using default program
How To Develop A Designer Media Player For Java Swing Application????
Urgent: JMF Player for real time voice input
Urgent -- How to open video or audio player through a GUI ?