Je suis en train d'utiliser la bibliothèque BrowserLauncher2 pour ouvrir le navigateur web par défaut de l'utilisateur à partir de mon application Swing, mais elle lance une exception très confuse :
public static void openURL(String url) {
try{
BrowserLauncher launcher = new BrowserLauncher();
launcher.openURLinBrowser(url);
}catch(Exception e){
e.printStackTrace();
}
}
Exception :
edu.stanford.ejalbert.exception.BrowserLaunchingExecutionException: java.lang.reflect.InvocationTargetException
at edu.stanford.ejalbert.launching.macos.MacOs3_1BrowserLaunching.openUrl(MacOs3_1BrowserLaunching.java:61)
at edu.stanford.ejalbert.BrowserLauncherRunner.run(BrowserLauncherRunner.java:136)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at edu.stanford.ejalbert.launching.macos.MacOs3_1BrowserLaunching.openUrl(MacOs3_1BrowserLaunching.java:58)
... 2 more
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission canOpenURLs)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
at java.security.AccessController.checkPermission(AccessController.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at com.apple.eio.FileManager.openURL(FileManager.java:229)
at com.apple.mrj.MRJPriv.openURL(MRJPriv.java:255)
at com.apple.mrj.MRJFileUtils.openURL(MRJFileUtils.java:206)
... 7 more