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
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.exeat the client machine usingRuntime#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.