tags:

views:

139

answers:

3

when try to execute the servlet containing following code

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

It doesn't launch the application in the environment windows server 2003 and Tomcat 5 but a process is being created as notepad.exe in the windows task manager.

In windows xp and tomcat 6 environment launches the notepad

i need to work on the windows server 2003 and tomcat 5

Thanks in advance

+2  A: 

In other words, it get launched on your local development machine (WinXP + Tomcat6), but not at a production/test server (Win2K3 + Tomcat5)?

Do you realize that Java Servlet code runs at the server machine, not at the client machine, which are in real world usually two physically different machines connected by a network? The notepad is opened at the server machine (there where the webserver (Tomcat) runs), not at the client machine (there where the webbrowser runs). That it works at local development environment is just because both the webserver and webbrowser runs at the physically same machine.

Login to your Win2K3 environment and you'll see that notepad is opened there.


If you really intend to launch notepad.exe at the client machine using Runtime#exec() (I don't see any business reasons for this, but that aside), then you'll need to provide the client a Java application in flavor of an Applet or Web Start Application served by a HTML/JSP page. This will get downloaded to the client machine and will be executed there.

BalusC
A: 

I think your tomcat runs as a service at the background. When running notepad it is executed with the same logon that your tomcat runs with. Most likely thats a different logon than your desktop-logon and thus the notepad won't be displayed at that desktop!

In your dev environment you started tomcat by executing the wrapper scripts directly. Try to install it as a service and you will get the same problems with XP.

Btw: I don't see a point in running an AppServer and calling notpad at the server. Are you really sure about the design?

Hardcoded
+1  A: 

If you could tell us the requirement to launch notepad.exe, then we could suggest a solution/approach to you.

Phani