Ulf Dittmer wrote:Look at the javadocs of that class - the constructor isn't listed, because it's not public. You can obtain a Desktop object via
Desktop mediaplayer = Desktop.getDesktop()
Note that this will not work when run in an IDE; that's what the Desktop.isDesktopSupported() method guards against.
I get you, yes thanks.
I wondered if anyone has been having a simalar problem to this. I am getting a runtime error now. the program can open documents but not mp3's:
import java.io.*;
import java.awt.*;
public class music {
public static void main (
String [] args)throws Exception {
File tester = new File("C:/etc/etc/asong.mp3");
Desktop mediaplayer = Desktop.getDesktop();
mediaplayer.open(tester);
}
}
Error on cmd line given as :
Failed to open file Invalid menu handle
at sun.awt.windows.WDEsktopPeer.ShellExecute(WDesktopPeer.java:59)
at sun.awt.windows.WDEsktopPeer.open(WDesktopPeer.java:36)
at java.awt.Desktop.open(desktop.jav:254)
at music.main(music.java:14)
Banging head against brick wall error!