I have a problem with Java Runtime
in Linux. I need to execute this command:
blastdbcmd -db '"mydb"' -info
So I use this Java code :
String[] cmd = new String[] {blastdbcmd ,"-db", "\'","\"", mydb,"\"","\'","-info"}
Process p = Runtime.getRuntime().exec(cmd);
p.waitFor();
but it doesn't work: every time I get a java.lang.NullPointerException
exception... can anybody help me?
If I try with :
blastdbcmd -db "mydb" -info
it works, but the simple quotes are necessary if I have a command like
blastdbcmd -db "mydb mydb2" -info
If the blastdbcmd is expecting arguments with literal double quote characters them:
String[] cmd = new String[] {"blastdbcmd", "-db", "\"mydb mydb2\"", "-info"};
which is equivalent to
$ blastdbcmd -db "\"mydb mydb2\"" -info
If not:
String[] cmd = new String[] {"blastdbcmd", "-db", "mydb mydb2", "-info"};
which is equivalent to
$ blastdbcmd -db "mydb mydb2" -info
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.