< prev index next >
modules/javafx.graphics/src/main/java/com/sun/javafx/application/HostServicesDelegate.java
Print this page
@@ -23,10 +23,11 @@
* questions.
*/
package com.sun.javafx.application;
+import java.awt.Desktop;
import java.io.File;
import java.lang.reflect.Method;
import java.net.URI;
import java.security.AccessController;
import java.security.PrivilegedActionException;
@@ -168,13 +169,11 @@
@Override
public void showDocument(final String uri) {
String osName = System.getProperty("os.name");
try {
if (osName.startsWith("Mac OS")) {
- Class.forName("com.apple.eio.FileManager").getDeclaredMethod(
- "openURL", new Class[]{String.class}).invoke(null,
- new Object[]{uri});
+ Desktop.getDesktop().browse(URI.create(uri));
} else if (osName.startsWith("Windows")) {
Runtime.getRuntime().exec(
"rundll32 url.dll,FileProtocolHandler " + uri);
} else { //assume Unix or Linux
String browser = null;
< prev index next >