1 /* 2 * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/devgui/BrowserTool.java,v 1.7 2004/08/18 12:25:57 hkollmann Exp $ 3 * $Revision: 1.7 $ 4 * $Date: 2004/08/18 12:25:57 $ 5 * 6 * DbForms - a Rapid Application Development Framework 7 * Copyright (C) 2001 Joachim Peer <joepeer@excite.com> 8 * 9 * This library is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU Lesser General Public 11 * License as published by the Free Software Foundation; either 12 * version 2.1 of the License, or (at your option) any later version. 13 * 14 * This library is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public 20 * License along with this library; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 */ 23 24 package org.dbforms.devgui; 25 26 import java.io.*; 27 28 29 30 /*** 31 * #fixme: code is kindof dirty.. 32 */ 33 public class BrowserTool { 34 /*** 35 * DOCUMENT ME! 36 * 37 * @param anURL DOCUMENT ME! 38 * 39 * @throws IOException DOCUMENT ME! 40 */ 41 public static void openURL(String anURL) throws IOException { 42 if (anURL.startsWith("http://") || anURL.startsWith("https://")) { 43 // WIN32 44 String osName = System.getProperties() 45 .getProperty("os.name") 46 .toLowerCase(); 47 System.out.println("os=" + osName); 48 49 if (osName.startsWith("win")) { 50 System.out.println("cmd /c start " + anURL); 51 Runtime.getRuntime() 52 .exec("cmd /c start " + anURL); 53 } 54 // UNIX, LINUX, MAC 55 else { 56 System.out.println("netscape " + anURL); 57 Runtime.getRuntime() 58 .exec("netscape " + anURL); 59 } 60 } else { 61 throw new IOException("Protocol should be either http or https."); 62 } 63 } 64 }