add exec module

This commit is contained in:
josch 2011-02-15 07:15:17 +01:00
parent 24be58c5a9
commit 511507f82d
2 changed files with 27 additions and 21 deletions

View file

@ -0,0 +1,24 @@
package de.unibremen.informatik.commons.exec;
public class ExecUtils {
static {
}
public ExecUtils() {
super();
}
public static void run(String cmd) {
try {
Process process = Runtime.getRuntime().exec(cmd);
try {
process.waitFor();
} catch (java.lang.InterruptedException e) {
e.printStackTrace();
}
} catch (java.io.IOException e) {
e.printStackTrace();
}
}
}

View file

@ -12,12 +12,12 @@ import java.util.HashSet;
import org.protege.editor.owl.ui.action.ProtegeOWLAction; import org.protege.editor.owl.ui.action.ProtegeOWLAction;
import org.protege.editor.core.ui.util.UIUtil; import org.protege.editor.core.ui.util.UIUtil;
import de.unibremen.informatik.commons.exec.ExecUtils;
public class LocalImportHetsAction extends ProtegeOWLAction { public class LocalImportHetsAction extends ProtegeOWLAction {
private static final long serialVersionUID = -4056096587762591108L; private static final long serialVersionUID = -4056096587762591108L;
private Process process;
@Override @Override
public void initialise() throws Exception { public void initialise() throws Exception {
} }
@ -39,24 +39,6 @@ public class LocalImportHetsAction extends ProtegeOWLAction {
e.printStackTrace(); e.printStackTrace();
} }
ExecUtils.run("sudo chroot /home/debian-squeeze-i386 /Hets/hets -o pp.xml \"/Hets-lib/trunk/Ontology/Examples/Family.het\"");
if(process != null) {
process.destroy();
process = null;
}
Runtime r = Runtime.getRuntime();
try {
process = r.exec("/usr/bin/hets" + " " + file.getAbsolutePath() + " -o pp.xml");
try {
process.waitFor();
} catch(InterruptedException irEx) {
irEx.printStackTrace();
}
} catch(IOException ioEx) {
ioEx.printStackTrace();
}
} }
} }