We made a .bat file by using the following code
#!/bin/sh
/home/burhan/hbase-0.94.15/bin/start-hbase.sh
/home/burhan/hbase-0.94.15/bin/hbase shell
The above code is run successfully by using the terminal and HBase is started. But when we run the bat file by using java in eclipse its not work. Why?
We write following code in java in eclipse:
Process p;
p=Runtime.getruntime().exec("sh -c /home/burhan/bat.sh");
When you use
-coption insh, it means you are passing commands as a string instead of a shell file. Hence the statementsh -c /home/burhan/bat.shmeans that/home/burhan/bat.shis the command you want to execute and not the file you want to execute.So to run the file remove the
-cargument,