• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
  • Tim Holloway
  • Carey Brown
  • salvin francis

runtime.exec on WebSphere Application Server not working

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 have a knack for fixing things like this ... um ... sorry ... here is a consilitory tiny ad:
create, convert, edit or print DOC and DOCX in Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!