Helpful Information
 
 
Category: Java
How to call exe from jsp dynamically without hardcoding file path

Hi all,
I face some problem, I want to run exe from JSP. I can run it but I need to give full path of file. I want to call dynamically without hardcoding fullpath. Just giving filename.

I don't want

exec ("C:\Program File\Coro\sign.exe");

I want

exec("sign.exe")

I don't know for sure but what about using the getRealPath method available in ServletContext interface.

Refer the docs from here (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String))

This method will give you the actual physical path of the executable file without hard coding the path in the source code.










privacy (GDPR)