( begin auto-generated from launch.xml ) Attempts to open an application or file using your platform's launcher. The file parameter is a String specifying the file name and location. The location parameter must be a full path name, or the name of an executable in the system's PATH. In most c
(String... args)
| 3491 | * @usage Application |
| 3492 | */ |
| 3493 | static public Process launch(String... args) { |
| 3494 | String[] params = null; |
| 3495 | |
| 3496 | if (platform == WINDOWS) { |
| 3497 | // just launching the .html file via the shell works |
| 3498 | // but make sure to chmod +x the .html files first |
| 3499 | // also place quotes around it in case there's a space |
| 3500 | // in the user.dir part of the url |
| 3501 | params = new String[] { "cmd", "/c" }; |
| 3502 | |
| 3503 | } else if (platform == MACOSX) { |
| 3504 | params = new String[] { "open" }; |
| 3505 | |
| 3506 | } else if (platform == LINUX) { |
| 3507 | // xdg-open is in the Free Desktop Specification and really should just |
| 3508 | // work on desktop Linux. Not risking it though. |
| 3509 | final String[] launchers = { "xdg-open", "gnome-open", "kde-open" }; |
| 3510 | for (String launcher : launchers) { |
| 3511 | if (openLauncher != null) break; |
| 3512 | try { |
| 3513 | Process p = Runtime.getRuntime().exec(new String[] { launcher }); |
| 3514 | /*int result =*/ p.waitFor(); |
| 3515 | // Not installed will throw an IOException (JDK 1.4.2, Ubuntu 7.04) |
| 3516 | openLauncher = launcher; |
| 3517 | } catch (Exception e) { } |
| 3518 | } |
| 3519 | if (openLauncher == null) { |
| 3520 | System.err.println("Could not find xdg-open, gnome-open, or kde-open: " + |
| 3521 | "the open() command may not work."); |
| 3522 | } |
| 3523 | if (openLauncher != null) { |
| 3524 | params = new String[] { openLauncher }; |
| 3525 | } |
| 3526 | //} else { // give up and just pass it to Runtime.exec() |
| 3527 | //open(new String[] { filename }); |
| 3528 | //params = new String[] { filename }; |
| 3529 | } |
| 3530 | if (params != null) { |
| 3531 | // If the 'open', 'gnome-open' or 'cmd' are already included |
| 3532 | if (params[0].equals(args[0])) { |
| 3533 | // then don't prepend those params again |
| 3534 | return exec(args); |
| 3535 | } else { |
| 3536 | params = concat(params, args); |
| 3537 | return exec(params); |
| 3538 | } |
| 3539 | } else { |
| 3540 | return exec(args); |
| 3541 | } |
| 3542 | } |
| 3543 | |
| 3544 | |
| 3545 | /** |