\r
package com.vaadin.launcher.util;\r
\r
+import java.io.BufferedInputStream;\r
+import java.io.BufferedReader;\r
+import java.io.File;\r
import java.io.IOException;\r
+import java.io.InputStreamReader;\r
\r
/**\r
* This class opens default browser for DemoLauncher class. Default browser is\r
\r
// Linux\r
if (os.indexOf("linux") >= 0) {\r
+ // See if the default browser is Konqueror by resolving the symlink.\r
+ boolean isDefaultKonqueror = false;\r
+ try {\r
+ // Find out the location of the x-www-browser link from path.\r
+ Process process = runtime.exec("which x-www-browser");\r
+ BufferedInputStream ins = new BufferedInputStream(process.getInputStream());\r
+ BufferedReader bufreader = new BufferedReader(new InputStreamReader(ins));\r
+ String defaultLinkPath = bufreader.readLine();\r
+ ins.close();\r
+\r
+ // The path is null if the link did not exist.\r
+ if (defaultLinkPath != null) {\r
+ // See if the default browser is Konqueror.\r
+ File file = new File(defaultLinkPath);\r
+ String canonical = file.getCanonicalPath();\r
+ if (canonical.indexOf("konqueror") != -1)\r
+ isDefaultKonqueror = true;\r
+ }\r
+ } catch (IOException e1) {\r
+ // The symlink was probably not found, so this is ok.\r
+ }\r
\r
- // Try x-www-browser\r
- if (!started) {\r
- try {\r
- runtime.exec("x-www-browser " + url);\r
- started = true;\r
- } catch (final IOException e) {\r
- }\r
+ // Try x-www-browser, which is symlink to the default browser,\r
+ // except if we found that it is Konqueror.\r
+ if (!started && !isDefaultKonqueror) {\r
+ try {\r
+ runtime.exec("x-www-browser " + url);\r
+ started = true;\r
+ } catch (final IOException e) {\r
+ }\r
}\r
\r
// Try firefox\r