You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Kevin Alonso <ka...@vicomtech.org> on 2009/11/26 15:53:42 UTC

How to run .exe file located inside .aar

Hello,

I have a web service that needs to call an .exe file and it is into the 
.aar file.

How can I do this? Which is the path I have to use in the instruction...

Process p = Runtime.getRuntime().exec("execution.exe");

Is there another way to do this?

Thank you in advance.

Kevin.

Re: How to run .exe file located inside .aar

Posted by hxrocha <hx...@hotmail.com>.
Good Morning Kevin. 

How do you solve this problem?


Kevin Alonso wrote:
> 
> 
> 
> 
>   
> 
> 
> Thank you for your help. 
> 
> Finally I solved the problem extracting exe from .aar to a temporal
> file. and then executing it. 
> 
> Regards, 
> 
> Kevin. 
> 
> Philippe A. escribi&oacute;:
> That doesn't address directly your problem, but I strongly
> recommend you have a look at Jakarta Commons Exec. It will save you
> lots of trouble. 
>   
>   http://commons.apache.org/ 
>   
>   
>   2009/11/27 Kevin Alonso &lt; kalonso@vicomtech.org &gt; 
>   I
> get the path of the file: 
>     
> URL url =
> getClass().getClassLoader().getResource("ColorClusteringFroga.exe"); 
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
> &nbsp; &nbsp; &nbsp; &nbsp; 
> String path = url.getPath(); 
>     
> (Path: C:/Program Files/Apache Software Foundation/Tomcat
> 6.0/temp/axis2-tmp-5629 
> 138317308731761.tmp/axis2593833549232759380WebService.aar!/execution.ex 
> e) 
>     
> But when I put it to execute: 
>     
> Process p = Runtime.getRuntime().exec(path); 
>     
>     
> &nbsp;I receive the following error: 
>     
> java.io.IOException: Cannot run program "C:/Program": CreateProcess
> error=2, The 
> &nbsp;system cannot find the file specified 
>     
> I think that it is becouse of !/ 
>     
> Any idea to solve this? 
>     
> Thank you in advance. 
>     
> Kevin. 
>     
>     
> Deepal jayasinghe escribi&oacute;: 
>     
> One way to do this is you can put the exe file somewhere else and you 
> can define the location from a parameter (in services.xml) and then use 
> the value of the parameter to load the exe file. One other way is you 
> can get the URI of the exe file from axisservice, and you may try to 
> execute it from that 
>       
> classloader.getResource("execution.exe") 
>       
> Thanks, 
> Deepal 
>       
> Hello, 
>         
> I have a web service that needs to call an .exe file and it is into 
> the .aar file. 
>         
> How can I do this? Which is the path I have to use in the instruction... 
>         
> Process p = Runtime.getRuntime().exec("execution.exe"); 
>         
> Is there another way to do this? 
>         
> Thank you in advance. 
>         
> Kevin. 
>         
>       
>       
>       
>     
>   
>   
>   
> 
> 
> 
> 
> 
-- 
View this message in context: http://old.nabble.com/How-to-run-.exe-file-located-inside-.aar-tp26530546p33976033.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: How to run .exe file located inside .aar

Posted by "Philippe A." <fu...@gmail.com>.
That doesn't address directly your problem, but I strongly recommend you
have a look at Jakarta Commons Exec. It will save you lots of trouble.

http://commons.apache.org/


2009/11/27 Kevin Alonso <ka...@vicomtech.org>

> I get the path of the file:
>
> URL url =
> getClass().getClassLoader().getResource("ColorClusteringFroga.exe");
>
> String path = url.getPath();
>
> (Path: C:/Program Files/Apache Software Foundation/Tomcat
> 6.0/temp/axis2-tmp-5629
> 138317308731761.tmp/axis2593833549232759380WebService.aar!/execution.ex
> e)
>
> But when I put it to execute:
>
> Process p = Runtime.getRuntime().exec(path);
>
>
>  I receive the following error:
>
> java.io.IOException: Cannot run program "C:/Program": CreateProcess
> error=2, The
>  system cannot find the file specified
>
> I think that it is becouse of !/
>
> Any idea to solve this?
>
> Thank you in advance.
>
> Kevin.
>
>
> Deepal jayasinghe escribió:
>
>> One way to do this is you can put the exe file somewhere else and you
>> can define the location from a parameter (in services.xml) and then use
>> the value of the parameter to load the exe file. One other way is you
>> can get the URI of the exe file from axisservice, and you may try to
>> execute it from that
>>
>> classloader.getResource("execution.exe")
>>
>> Thanks,
>> Deepal
>>
>>> Hello,
>>>
>>> I have a web service that needs to call an .exe file and it is into
>>> the .aar file.
>>>
>>> How can I do this? Which is the path I have to use in the instruction...
>>>
>>> Process p = Runtime.getRuntime().exec("execution.exe");
>>>
>>> Is there another way to do this?
>>>
>>> Thank you in advance.
>>>
>>> Kevin.
>>>
>>>
>>
>>

Re: How to run .exe file located inside .aar

Posted by Jens Goldhammer <go...@googlemail.com>.
Hello Kevin,

try to put the path into brackets! Windows does not like path-elements with
spaces in it :-(

path="\"" + path +"\"";
Process p = Runtime.getRuntime().exec(path);

I hope, this helps...
Jens


Kevin Alonso wrote:
> 
> I get the path of the file:
> 
> URL url = 
> getClass().getClassLoader().getResource("ColorClusteringFroga.exe");
>                      				
> String path = url.getPath();
> 
> (Path: C:/Program Files/Apache Software Foundation/Tomcat 
> 6.0/temp/axis2-tmp-5629
> 138317308731761.tmp/axis2593833549232759380WebService.aar!/execution.ex
> e)
> 
> But when I put it to execute:
> 
> Process p = Runtime.getRuntime().exec(path);
> 
> 
>   I receive the following error:
> 
> java.io.IOException: Cannot run program "C:/Program": CreateProcess 
> error=2, The
>   system cannot find the file specified
> 
> I think that it is becouse of !/
> 
> Any idea to solve this?
> 
> Thank you in advance.
> 
> Kevin.
> 
> 
> Deepal jayasinghe escribió:
>> One way to do this is you can put the exe file somewhere else and you
>> can define the location from a parameter (in services.xml) and then use
>> the value of the parameter to load the exe file. One other way is you
>> can get the URI of the exe file from axisservice, and you may try to
>> execute it from that
>> 
>> classloader.getResource("execution.exe")
>> 
>> Thanks,
>> Deepal
>>> Hello,
>>>
>>> I have a web service that needs to call an .exe file and it is into
>>> the .aar file.
>>>
>>> How can I do this? Which is the path I have to use in the instruction...
>>>
>>> Process p = Runtime.getRuntime().exec("execution.exe");
>>>
>>> Is there another way to do this?
>>>
>>> Thank you in advance.
>>>
>>> Kevin.
>>>
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-run-.exe-file-located-inside-.aar-tp26530546p26572260.html
Sent from the Axis - User mailing list archive at Nabble.com.


Re: How to run .exe file located inside .aar

Posted by Kevin Alonso <ka...@vicomtech.org>.
I get the path of the file:

URL url = 
getClass().getClassLoader().getResource("ColorClusteringFroga.exe");
                     				
String path = url.getPath();

(Path: C:/Program Files/Apache Software Foundation/Tomcat 
6.0/temp/axis2-tmp-5629
138317308731761.tmp/axis2593833549232759380WebService.aar!/execution.ex
e)

But when I put it to execute:

Process p = Runtime.getRuntime().exec(path);


  I receive the following error:

java.io.IOException: Cannot run program "C:/Program": CreateProcess 
error=2, The
  system cannot find the file specified

I think that it is becouse of !/

Any idea to solve this?

Thank you in advance.

Kevin.


Deepal jayasinghe escribió:
> One way to do this is you can put the exe file somewhere else and you
> can define the location from a parameter (in services.xml) and then use
> the value of the parameter to load the exe file. One other way is you
> can get the URI of the exe file from axisservice, and you may try to
> execute it from that
> 
> classloader.getResource("execution.exe")
> 
> Thanks,
> Deepal
>> Hello,
>>
>> I have a web service that needs to call an .exe file and it is into
>> the .aar file.
>>
>> How can I do this? Which is the path I have to use in the instruction...
>>
>> Process p = Runtime.getRuntime().exec("execution.exe");
>>
>> Is there another way to do this?
>>
>> Thank you in advance.
>>
>> Kevin.
>>
> 
> 

Re: How to run .exe file located inside .aar

Posted by Deepal jayasinghe <de...@gmail.com>.
One way to do this is you can put the exe file somewhere else and you
can define the location from a parameter (in services.xml) and then use
the value of the parameter to load the exe file. One other way is you
can get the URI of the exe file from axisservice, and you may try to
execute it from that

classloader.getResource("execution.exe")

Thanks,
Deepal
> Hello,
>
> I have a web service that needs to call an .exe file and it is into
> the .aar file.
>
> How can I do this? Which is the path I have to use in the instruction...
>
> Process p = Runtime.getRuntime().exec("execution.exe");
>
> Is there another way to do this?
>
> Thank you in advance.
>
> Kevin.
>


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org