I have one large group of users that cannot launch a locally created file (PDF, Word, etc.) from within a signed applet. Double clicking the file from Windows Explorer launches it so the file association to the launching app is known. Tech support logs in remotely on a machine with UAC enabled and sees no problem loading the applet and can launch the local file without a problem. This makes me think the large group has a common local setting. Users are running Java 1.6u31 on Windows XP (or 7, not sure). There is no error displayed and nothing in the java console (all hearsay since I do not see the problem). Any suggestions for what local PC settings that may cause this behavior? Per the code, it looks like the problem is Desktop is supported, but Desktop.Action.OPEN is not. Any suggestions why? Thanks.
I am using the following to launch the file:
/*
//old way that would work for Windows prior to Java 1.6
//cmd = System.getenv("windir") +"\\system32\\"+"rundll32 SHELL32.DLL,ShellExec_RunDLL " + cmd;
//cmd = "open "+cmd; // Mac for PDF only?
//try{
// Runtime.getRuntime().exec(cmd);
//} catch (Exception e) {
// //handle error
//}
*/
Desktop desktop = null;
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
if (desktop.isSupported(Desktop.Action.OPEN)) {
try {
desktop.open(new File(file));
return;
} catch (IOException e) {
//Error launching the file
e.printStackTrace();
JOptionPane.showMessageDialog(theFrame,
"Unable to launch the file.",
"Document Error", JOptionPane.ERROR_MESSAGE);
return;
}
}
} else {
//This OS cannot launch the file
JOptionPane.showMessageDialog(theFrame,
"This operating system is unable" +
"\nto launch external files" +
"\nfrom within this application.",
"Document Error", JOptionPane.ERROR_MESSAGE);
return;
}