add exec module

main
josch 13 years ago
parent 24be58c5a9
commit 511507f82d

@ -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();
}
}
}

@ -12,12 +12,12 @@ import java.util.HashSet;
import org.protege.editor.owl.ui.action.ProtegeOWLAction;
import org.protege.editor.core.ui.util.UIUtil;
import de.unibremen.informatik.commons.exec.ExecUtils;
public class LocalImportHetsAction extends ProtegeOWLAction {
private static final long serialVersionUID = -4056096587762591108L;
private Process process;
@Override
public void initialise() throws Exception {
}
@ -39,24 +39,6 @@ public class LocalImportHetsAction extends ProtegeOWLAction {
e.printStackTrace();
}
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();
}
ExecUtils.run("sudo chroot /home/debian-squeeze-i386 /Hets/hets -o pp.xml \"/Hets-lib/trunk/Ontology/Examples/Family.het\"");
}
}

Loading…
Cancel
Save