This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Websphere and the fly likes runtime.exec on WebSphere Application Server not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Products » Websphere
Bookmark "runtime.exec on WebSphere Application Server not working" Watch "runtime.exec on WebSphere Application Server not working" New topic

runtime.exec on WebSphere Application Server not working

Rishikesh Dagwal

Joined: Apr 10, 2008
Posts: 2

I am using [ IBM WebSphere Application Server,, Build Number: o0445.08, Build Date: 11/10/04 ]
This server is running as windows service.

I have a web application deployed on it. The task of this web application is to start a exe file using following code

Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec( command, env );

command = the executable with parameters
env = String array that contains strings (in key=value format) read from a file env.txt.

This env.txt file is a properties file and contains system environment variables.

One property from this file contains path of a mapped network drive i.e. MY_DATA=Y:\\
The executable stated above reads from the mapped network drive.
When I deployed and started this application on WebSphere Application Server,, exe fails to start . If I use UNC path instead of mapped network drive path ( i.e. \\\\host\\sharedFolderName instaed of Y:\\ ) then exe starts normally.

In stand alone mode ( run from command promt ) this exe runs normally using the same env with both mapped network drive as well as UNC path.

I have deployed same application on tomcat 5.5.20 and WAS CE 1.0. It runs normally on these servers. Problem occurs only on WebSphere Application Server, running as windows service.

I discovered one work around for this issue. I removed windows service for the WebSphere Application Server, using 'wasservice.exe -remove' command. Started websphere server using startServer.bat file. In this case exe gets started normally using both mapped network drive as well as UNC path.

Can any one suggest where is the problem and what is the solution for it if want my WebSphere Application Server, is to be run as windows service?

I am sure that problem is some where in process context where exe gets executed. Becasue the same thing is running normally in both WAS CE 1.0 and Tomcat 5.5.20. May be the process context for these two server are different which can understand the mapped network drive. Also when I remove windows services for WebSphere Application Server, then it runs fine because may be it is using the different process context.

If anyone have idea about it kindly share it ASAP.

Best Regards,
I agree. Here's the link:
subject: runtime.exec on WebSphere Application Server not working
It's not a secret anymore!