Skip to main content

file can not be open under windows7, but winxp.

No replies
perdure
Offline
Joined: 2005-05-19

can anybody help? thanks!

import java.awt.Desktop;
import java.io.File;
import java.io.IOException;

public class DesktopTest {

/**
* @param args
*/
public static void main(String[] args) {
Desktop desktop = Desktop.getDesktop();
String tempDir = System.getProperty("java.io.tmpdir");
System.out.println(tempDir);
File file = new File("d:\\ly.rar");
try {
if(desktop.isSupported(Desktop.Action.OPEN)) {
desktop.open(file);
}

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

}