JAVA FILE or I/O学习 - Desktop本地程序学习
1 public class DesktopKnow 2 { 3 public void know() 4 { 5 try 6 { 7 Desktop.getDesktop().open(new File("C:\\Program Files")); 8 } catch (IOException e1) 9 { 10 JOptionPane.showMessageDialog(null, "抱歉,您的电脑中还没有安装打开该文件的程序!", "打开文件 - 提示", JOptionPane.WARNING_MESSAGE); 11 } 12 } 13 public static void main(String[] args) 14 { 15 DesktopKnow desktopKnow = new DesktopKnow(); 16 desktopKnow.know(); 17 } 18 }