Hi, I am trying to run some Java code I found on linux.
maudecmd = new String[files.length+5];
maudecmd[0] = "maude";
maudecmd[1] = "-no-banner";
maudecmd[2] = "-no-ansi-color";
maudecmd[3] = "-no-mixfix";
maudecmd[4] = "-no-wrap";
for(int i = 0; i < files.length; ++i) {
maudecmd[5+i] = files[i];
}
ProcessBuilder pb = new ProcessBuilder(maudecmd);
if(dir != null)
pb.directory(dir);
pb.redirectErrorStream(true);
maude = pb.start();
This throws an IOException - bash can't find the 'maude' command.
I have this aliased in my .bashrc file though:
alias maude='~/lib/maude/maude.linux'
If I change the code like this:
maudecmd[0] = "/u/h/os215/lib/maude/maude.linux";
It works fine.
I want to change this code so it is more robust - if someone can run Maude on the command line the ProcessBuilder should also be able to use it, whatever specific method the user has to link Maude up.
Can this be acheived?