JAVA FILE or I/O学习 - Desktop本地程序学习

时间:2021-12-10 21:27:37
 public class DesktopKnow
{
public void know()
{
try
{
Desktop.getDesktop().open(new File("C:\\Program Files"));
} catch (IOException e1)
{
JOptionPane.showMessageDialog(null, "抱歉,您的电脑中还没有安装打开该文件的程序!", "打开文件 - 提示", JOptionPane.WARNING_MESSAGE);
}
}
public static void main(String[] args)
{
DesktopKnow desktopKnow = new DesktopKnow();
desktopKnow.know();
}
}