private void run(String[] args) { Version version = Version.parseVersionFromManifest(); log.info( "Started RouteConverter " + version.getVersion() + " from " + version.getDate() + " on " + Platform.getOsName() + " with " + Platform.getJvm()); if (args.length != 3) { log.info( "Usage: java -jar RouteConverterCmdLine.jar <source file> <target format> <target file>"); logFormatNames(NavigationFormats.getWriteFormatsSortedByName()); System.exit(5); } File source = new File(args[0]); if (!source.exists()) { log.severe("Source '" + source.getAbsolutePath() + "' does not exist; stopping."); System.exit(10); } BaseNavigationFormat format = findFormat(args[1]); if (format == null) { log.severe("Format '" + args[1] + "' does not exist; stopping."); logFormatNames(NavigationFormats.getWriteFormatsSortedByName()); System.exit(12); } String baseName = Files.removeExtension(args[2]); File target = new File(baseName + format.getExtension()); if (target.exists()) { log.severe("Target '" + target.getAbsolutePath() + "' already exists; stopping."); System.exit(13); } try { convert(source, format, target); } catch (IOException e) { log.severe("Error while converting: " + e.getMessage()); System.exit(15); } System.exit(0); }
private JWebBrowser createWebBrowser() { try { if (!NativeInterface.isOpen()) throw new Exception("Native Interface is not initialized"); JWebBrowser browser; if (Platform.isLinux()) { if (Platform.is64Bit()) { try { System.setProperty("org.eclipse.swt.browser.UseWebKitGTK", "true"); // System.setProperty("nativeswing.webbrowser.runtime", "webkit"); browser = new JWebBrowser(JWebBrowser.useWebkitRuntime()); log.info("Using WebKit runtime to create WebBrowser"); } catch (IllegalStateException e) { System.clearProperty("org.eclipse.swt.browser.UseWebKitGTK"); browser = new JWebBrowser(JWebBrowser.useXULRunnerRuntime()); log.info("Using XULRunner runtime to create WebBrowser: " + e.getMessage()); } } else { try { System.setProperty("org.eclipse.swt.browser.UseWebKitGTK", "true"); browser = new JWebBrowser(JWebBrowser.useWebkitRuntime()); log.info("Using WebKit runtime to create WebBrowser"); } catch (IllegalStateException e) { System.clearProperty("org.eclipse.swt.browser.UseWebKitGTK"); browser = new JWebBrowser(JWebBrowser.useXULRunnerRuntime()); log.info("Using XULRunner runtime to create WebBrowser: " + e.getMessage()); } } } else { browser = new JWebBrowser(); } browser.setBarsVisible(false); browser.setJavascriptEnabled(true); return browser; } catch (Throwable t) { log.severe("Cannot create WebBrowser: " + t.getMessage()); setInitializationCause(t); return null; } }
public boolean isSupportedPlatform() { return Platform.isLinux() || Platform.isMac() || Platform.isWindows(); }