从桌面用默认程序打开file

import java.awt.Desktop;
import java.io.*;java

public static void main(String[] args) {
  // TODO Auto-generated method stub
  Desktop desktop = null;
  try{ this

    // Before more Desktop API is used, first check spa

    // whether the API is supported by this particular code

    // virtual machine (VM) on this particular host.get

    if (Desktop.isDesktopSupported()) {
      desktop = Desktop.getDesktop();
      desktop.open(new File("/home/illy/song.mp3"));
    }
   }
  catch (IOException e) {
    e.printStackTrace();
   }
}io

相关文章
相关标签/搜索