# application.executeProgram throws an exception

**URL:** <https://forum.servoy.com/t/application-executeprogram-throws-an-exception/13402>\
**Category:** Classic Servoy\
**Created:** [January 5, 2011, 6:15am UTC](https://forum.servoy.com/t/application-executeprogram-throws-an-exception/13402 "2011-01-05T06:15:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![erikd](https://avatars.discourse-cdn.com/v4/letter/e/b782af/32.png) [@erikd](https://forum.servoy.com/u/erikd)\
**Post date:** [January 5, 2011, 6:15am UTC](https://forum.servoy.com/t/application-executeprogram-throws-an-exception/13402/1 "2011-01-05T06:15:26Z")

</div>

I would like to use application.executeProgram to run an application. The application’s bin location is already placed in the “Path” of System variables so as not to include it in the parameter. I am calling it as follows:

application.executeProgram(“application.exe”);

This is working in the developer mode but not when deployed in the apache server. Any input regarding this is highly appreciated. Thanks.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [January 5, 2011, 8:03am UTC](https://forum.servoy.com/t/application-executeprogram-throws-an-exception/13402/2 "2011-01-05T08:03:09Z")

</div>

smart or webclient?

for a smart client that should work if on the smart clients pc it can find that application.exe  
for a webclient this will not work because that will be executed on the server not on the client (browser) itself.

---

<div class="post-metadata">

**Author:** ![erikd](https://avatars.discourse-cdn.com/v4/letter/e/b782af/32.png) [@erikd](https://forum.servoy.com/u/erikd)\
**Post date:** [January 6, 2011, 10:22pm UTC](https://forum.servoy.com/t/application-executeprogram-throws-an-exception/13402/3 "2011-01-06T22:22:02Z")

</div>

I am using a smart client. The code works when I run the solution through the Servoy developer.

But when I deploy the solution in the server, the code does not see the path and cannot run the application.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [January 6, 2011, 10:22pm UTC](https://forum.servoy.com/t/application-executeprogram-throws-an-exception/13402/4 "2011-01-06T22:22:57Z")

</div>

what if you really place that application.exe somewhere on that smart client and you use a hard path to it?

---

<div class="post-metadata">

**Author:** ![erikd](https://avatars.discourse-cdn.com/v4/letter/e/b782af/32.png) [@erikd](https://forum.servoy.com/u/erikd)\
**Post date:** [January 7, 2011, 2:25am UTC](https://forum.servoy.com/t/application-executeprogram-throws-an-exception/13402/5 "2011-01-07T02:25:05Z")

</div>

> jcompagner:  
> what if you really place that application.exe somewhere on that smart client and you use a hard path to it?

When I place the full path of the application, it works well. But what I would like to do is to allow the user to set the path of the application.exe from the “Path” system variables. When I do this a dialog box displaying “Program execution failed.” is displayed.

It seems that application.executeProgram only works if the full path is included as the parameter. It does not act like a windows command prompt which looks for corresponding file in “Path” system environment variable.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [January 7, 2011, 12:37pm UTC](https://forum.servoy.com/t/application-executeprogram-throws-an-exception/13402/6 "2011-01-07T12:37:56Z")

</div>

We call Runtime.exec() on it. And that is really executed a program, that is not the same as a windows command prompt i think.

what you could try is this:

“cmd /c application.exe”

---

<div class="post-metadata">

**Author:** ![erikd](https://avatars.discourse-cdn.com/v4/letter/e/b782af/32.png) [@erikd](https://forum.servoy.com/u/erikd)\
**Post date:** [January 9, 2011, 9:36pm UTC](https://forum.servoy.com/t/application-executeprogram-throws-an-exception/13402/7 "2011-01-09T21:36:30Z")

</div>

> jcompagner:  
> We call Runtime.exec() on it. And that is really executed a program, that is not the same as a windows command prompt i think.
> 
> what you could try is this:
> 
> “cmd /c application.exe”

Thanks for this.
