I am trying to use the method Runtime.getRuntime().exec in a servlet.But there seems to be a path problem as it is giving IO exception.I have given path related to the servlet.What mistake am I doing ??
Thanx & Regards Anurag Bhalla Project Trainee Usha Martin Infotech Ltd. 63,Udyog Vihar phase- IV Gurgaon, Haryana Ph. No - 6398071-78 Ext - 466
Sandeep Jain
Ranch Hand
Joined: Oct 25, 2000
Posts: 124
posted
0
Hello, Even I have made use of Runtime.exec() method and it works fine. Can u put ur code here, with the path where u r putting ur file as it becomes easy to debug or trace the error.
------------------ Sandeep Jain
Try and Try Till u succeed<br /> <br />Sandeep Jain
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
posted
0
"anuragbhalla", The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements. Thanks.
Your problem is probably because you are expecting the "current directory" to be set to something in particular. Servlet containers are free to set the "current directory" to whatever they linke, so you should always either use an absolute path for all executables and files you access from a servlet, or implement some way of deciding where to look (servletContext.getRealPath(), an init parameter or whatever).
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
Thanx Frank The problem was that I was not giving absolute path.
------------------ Thanx & Regards Anurag Bhalla Project Trainee Usha Martin Infotech Ltd. 63,Udyog Vihar phase- IV Gurgaon, Haryana India Ph. No - 6398071-78 Ext - 466
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
posted
0
Thanks for choosing a new name, we do apprectate it.