[Biojava-l] Using Java to create BLAST searches

Andy Yates ayates at ebi.ac.uk
Wed Nov 1 10:00:23 UTC 2006

Hi Graham,

Your problem is probably that you're running this via sh which windows 
does not have. Even if you are running this via cygwin as far as I'm 
aware the JVM will use a normal windows shell/cmd. My advice would be to 
drop the sh and just try running the command as normal and see how that 

Failing that BioJava has org.biojava.utils.ExecRunner which is quite 
good and takes into account a few lessons learned from this article on 
using runtime:


Hope that helps,

Andy Yates

Graham Etherington wrote:
> Hi,
> I'm developing on Windows (using Apache Tomcat) using jsp's to create BLAST
> searches on a local BLAST database. Even though I'm not using BioJava
> (intend to use it to parse the results), I thought this formum would be the
> best place to ask for help.
> Even when I hard code a good BLAST search I keep getting the same error when
> I run my search, namely: 
> " java.io.IOException: CreateProcess: sh -c "C:/Program Files/Apache
> Software Foundation/Tomcat 5.5/blast/bin/blastall -p blastn -d ecoli.nt -i
> test.fas -o blast.out" error=2 "
> The pertinent bits of code I'm using are...
> String cmd = "C:/Program Files/Apache Software Foundation/Tomcat
> 5.5/blast/bin/blastall -p blastn -d ecoli.nt -i test.fas -o blast.out";
> ............
> Runtime r = Runtime.getRuntime ();
> Process runBlast = r.exec (new String[] {"sh","-c",cmd});
> runBlast.waitFor ();
> out.println ("Waiting for result");
> //Write the results
> BufferedReader br = new BufferedReader (new FileReader (output));
> String line = null;
> String results = "";
> while ( (line = br.readLine ()) != null )
> results = results.concat ("/n" + line);
> .............
> I'm not sure why it give me an IOException. I've checked that the file input
> file exists and that all the paths are correct.
> Any ideas?
> Many thanks,
> Graham
> _______________________________________________
> Biojava-l mailing list  -  Biojava-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biojava-l

More information about the Biojava-l mailing list