views:

232

answers:

1

I am calling an exe file called myapp.exe via a Spring Controller; here is the code in the controller: Runtime.getRuntime().exec("D:\vmd\apps\myapp.exe");

myapp.exe is a C# .NET application. If I click directly on myapp.exe using Windows Explorer, the application opens up and runs; however, if I call the command through a Spring Controller within Tomcat, the application does not open up; but, when I open Task Manager I can see that the myapp.exe process is running. Nevertheless, the window for myapp.exe does not open up. In JBoss, the application is successfully invoked via the Spring Controller. Does anyone know why the .NET application does not open via Tomcat?

Tomcat is installed as a service. When starting Tomcat manually using the startup.bat file, and then invoking myapp.exe from a link within the Tomcat webapp, myapp.exe launches successfully. However, I am not sure about wether or not Tomcat being started as a service is preventing myapp.exe from running properly, because when JBoss was started as a service, myapp.exe launched successfully.

+1  A: 

In Windows, a process running as a service cannot access the regular user desktop. And since a program started by a service inherits this property, it usually is not allowed to get to the desktop either.

As you state, that the Tomcat is running as service, I think this is the cause of the problem. Cannot find a suitable reference for this right now, sorry.

Why not have your .NET application start automatically in a user session? You could connect to the Tomcat via socket, waiting for some kind of start signal to arrive, which would then trigger the mapping the application's main window.

Dirk