Home » Eclipse Projects » Plugin Development Environment (PDE) » how to run bash script programmatically from eclipse plugin
how to run bash script programmatically from eclipse plugin [message #50747] |
Wed, 18 March 2009 10:06  |
Eclipse User |
|
|
|
Hi
how can i run bash script programmtically from eclipse plugin.
I tried using java runtime, but it does not work. The script is working
when called from command line or simple java application.
Runtime.getRuntime().exec(new String{"/home/script.sh","param1","param2"});
regards,
Sana.
|
|
|
Re: how to run bash script programmatically from eclipse plugin [message #50862 is a reply to message #50747] |
Wed, 18 March 2009 14:38   |
Eclipse User |
|
|
|
Sana wrote:
Sana wrote:
> Hi
>
> how can i run bash script programmtically from eclipse plugin.
> I tried using java runtime, but it does not work. The script is working
> when called from command line or simple java application.
>
> Runtime.getRuntime().exec(new String{"/home/script.sh","param1","param2"});
>
> regards,
> Sana.
>
> Hi
>
> how can i run bash script programmtically from eclipse plugin.
> I tried using java runtime, but it does not work. The script is working
> when called from command line or simple java application.
>
> Runtime.getRuntime().exec(new String{"/home/script.sh","param1","param2"});
>
> regards,
> Sana.
>
From my experience on windows, you will probably have to prefix
"/bin/bash" before your command.
Runtime.getRuntime().exec(new String{"/bin/bash",
"/home/script.sh","param1","param2"});
|
|
| | |
Re: how to run bash script programmatically from eclipse plugin [message #593393 is a reply to message #50747] |
Wed, 18 March 2009 14:38  |
Eclipse User |
|
|
|
Sana wrote:
Sana wrote:
> Hi
>
> how can i run bash script programmtically from eclipse plugin.
> I tried using java runtime, but it does not work. The script is working
> when called from command line or simple java application.
>
> Runtime.getRuntime().exec(new String{"/home/script.sh","param1","param2"});
>
> regards,
> Sana.
>
> Hi
>
> how can i run bash script programmtically from eclipse plugin.
> I tried using java runtime, but it does not work. The script is working
> when called from command line or simple java application.
>
> Runtime.getRuntime().exec(new String{"/home/script.sh","param1","param2"});
>
> regards,
> Sana.
>
From my experience on windows, you will probably have to prefix
"/bin/bash" before your command.
Runtime.getRuntime().exec(new String{"/bin/bash",
"/home/script.sh","param1","param2"});
|
|
|
Re: how to run bash script programmatically from eclipse plugin [message #593476 is a reply to message #50862] |
Thu, 19 March 2009 09:27  |
Eclipse User |
|
|
|
Well, on linux, it does not seem to work. Infact ,if i ask for return
value of this subprocess, the process throws
java.lang.IllegalThreadStateException process has not exited.
try{
Runtime r = Runtime.getRuntime();
Process proc = r.exec(new
String{"/bin/sh","/home/script.sh","param1","param2"});
int exit_val = proc.exitValue();
}catch(Exception e){
e.printStackTrace();
}
thanks for any help,
|
|
| |
Goto Forum:
Current Time: Thu Mar 13 17:10:42 EDT 2025
Powered by FUDForum. Page generated in 0.04791 seconds
|