Red Hat Application Migration Toolkit
package com.lowagie.tools;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
public class Executable {
public static String acroread = null;
private static Process action(String var0, String var1, boolean var2) throws IOException {
Process var3 = null;
if(var1.trim().length() > 0) {
var1 = " " + var1.trim();
} else {
var1 = "";
}
if(acroread != null) {
var3 = Runtime.getRuntime().exec(acroread + var1 + " \"" + var0 + "\"");
} else if(isWindows()) {
if(isWindows9X()) {
var3 = Runtime.getRuntime().exec("command.com /C start acrord32" + var1 + " \"" + var0 + "\"");
} else {
var3 = Runtime.getRuntime().exec("cmd /c start acrord32" + var1 + " \"" + var0 + "\"");
}
} else if(isMac()) {
if(var1.trim().length() == 0) {
var3 = Runtime.getRuntime().exec(new String[]{"/usr/bin/open", var0});
} else {
var3 = Runtime.getRuntime().exec(new String[]{"/usr/bin/open", var1.trim(), var0});
}
}
try {
if(var3 != null && var2) {
var3.waitFor();
}
} catch (InterruptedException var5) {
;
}
return var3;
}
public static final Process openDocument(String var0, boolean var1) throws IOException {
return action(var0, "", var1);
}
public static final Process openDocument(File var0, boolean var1) throws IOException {
return openDocument(var0.getAbsolutePath(), var1);
}
public static final Process openDocument(String var0) throws IOException {
return openDocument(var0, false);
}
public static final Process openDocument(File var0) throws IOException {
return openDocument(var0, false);
}
public static final Process printDocument(String var0, boolean var1) throws IOException {
return action(var0, "/p", var1);
}
public static final Process printDocument(File var0, boolean var1) throws IOException {
return printDocument(var0.getAbsolutePath(), var1);
}
public static final Process printDocument(String var0) throws IOException {
return printDocument(var0, false);
}
public static final Process printDocument(File var0) throws IOException {
return printDocument(var0, false);
}
public static final Process printDocumentSilent(String var0, boolean var1) throws IOException {
return action(var0, "/p /h", var1);
}
public static final Process printDocumentSilent(File var0, boolean var1) throws IOException {
return printDocumentSilent(var0.getAbsolutePath(), var1);
}
public static final Process printDocumentSilent(String var0) throws IOException {
return printDocumentSilent(var0, false);
}
public static final Process printDocumentSilent(File var0) throws IOException {
return printDocumentSilent(var0, false);
}
public static final void launchBrowser(String var0) throws IOException {
try {
if(isMac()) {
Class var1 = Class.forName("com.apple.mrj.MRJFileUtils");
Method var2 = var1.getDeclaredMethod("openURL", new Class[]{String.class});
var2.invoke((Object)null, new Object[]{var0});
} else if(isWindows()) {
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + var0);
} else {
String[] var5 = new String[]{"firefox", "opera", "konqueror", "mozilla", "netscape"};
String var6 = null;
for(int var3 = 0; var3 < var5.length && var6 == null; ++var3) {
if(Runtime.getRuntime().exec(new String[]{"which", var5[var3]}).waitFor() == 0) {
var6 = var5[var3];
}
}
if(var6 == null) {
throw new Exception("Could not find web browser.");
}
Runtime.getRuntime().exec(new String[]{var6, var0});
}
} catch (Exception var4) {
throw new IOException("Error attempting to launch web browser");
}
}
public static boolean isWindows() {
String var0 = System.getProperty("os.name").toLowerCase();
return var0.indexOf("windows") != -1 || var0.indexOf("nt") != -1;
}
public static boolean isWindows9X() {
String var0 = System.getProperty("os.name").toLowerCase();
return var0.equals("windows 95") || var0.equals("windows 98");
}
public static boolean isMac() {
String var0 = System.getProperty("os.name").toLowerCase();
return var0.indexOf("mac") != -1;
}
public static boolean isLinux() {
String var0 = System.getProperty("os.name").toLowerCase();
return var0.indexOf("linux") != -1;
}
}