Skip to content

Instantly share code, notes, and snippets.

@iugonet
Last active August 29, 2015 14:17
Show Gist options
  • Save iugonet/6b3992a79f9a389759cc to your computer and use it in GitHub Desktop.
Save iugonet/6b3992a79f9a389759cc to your computer and use it in GitHub Desktop.
import java.util.ArrayList;
import org.apache.commons.lang3.SystemUtils;
class ExternalModel {
private String suffix;
private ArrayList<String> arrayList;
ExternalModel() {
arrayList = new ArrayList<String>();
if (SystemUtils.IS_OS_WINDOWS) {
suffix = ".win64";
} else if (SystemUtils.IS_OS_LINUX) {
suffix = ".linux64";
} else if (SystemUtils.IS_OS_MAC) {
suffix = getClass().getSimpleName() + ".mac64";
}
}
public void exec() {
String[] cmdArray = new String[arrayList.size()];
try {
for (int i = 0; i < arrayList.size(); i++) {
cmdArray[i] = arrayList.get(i);
}
Process process = Runtime.getRuntime().exec(cmdArray, null, null);
} catch (Exception ex) {
ex.printStackTrace();
}
}
public String getSuffix() {
return suffix;
}
public void setSuffix(String suffix) {
this.suffix = suffix;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment