BrowserOutputStart.java 1006 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5. package schemaspygui;
  6. import java.io.*;
  7. /**
  8. *
  9. * @author joachim uhl; mailto:admin@joachim-uhl.de; http://www.joachim-uhl.de/projekte/schemaspygui/
  10. */
  11. public class BrowserOutputStart {
  12. static String url;
  13. public BrowserOutputStart( String url_in ) {
  14. url = "file://" +url_in;
  15. }
  16. public static void launch() {
  17. try {
  18. if (isWindows()) {
  19. Runtime.getRuntime().exec( "rundll32 url.dll,FileProtocolHandler "
  20. + url );
  21. } else {
  22. Runtime.getRuntime().exec("firefox " + url);
  23. }
  24. } catch (IOException ioe) {
  25. ioe.printStackTrace();
  26. }
  27. }
  28. public static boolean isWindows() {
  29. String os = System.getProperty("os.name");
  30. if ( os != null && os.startsWith("Windows")) {
  31. return true;
  32. } else {
  33. return false;
  34. }
  35. }
  36. }