File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes open a .exe thru servet (DLL Problem) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "open a .exe thru servet (DLL Problem)" Watch "open a .exe thru servet (DLL Problem)" New topic

open a .exe thru servet (DLL Problem)

noddy j

Joined: Feb 19, 2001
Posts: 2
i have a servlet code which is opening a .exe file from the
server on to the client machine.
the code written below works fine to open the .exe from server
on to the client machine.
but it asks for a .DLL file which is already present in the same
folder as the .exe.
howeever , when this .exe is opened by double clicking on it
it opens fine without any DLL problem.
but when accessed thru this servlet it gives error' DLL not found'. but the DLL is already present in the same folder as the .exe file. if not ,where should the DLL be?
so what is the problem.
pls help .
Kamal J

here is the code)

import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class filedownload extends HttpServlet
public void doGet(HttpServletRequest sReq ,HttpServletResponse sRes)
throws IOException,ServletException

String fileWanted="nowork.exe"
String pathOfFile = "c:/"+ "Downloadablefiles"+"\\" + fileWanted;

//Downlaodablefiles is the name of folder where nowork.exe is
File F = new File(pathOfFile);
//the next statement is the most IMPORTANT statement
sRes.setHeader("Content-Disposition", "attachment;filename=\"" + fileWanted +"\"");
ServletOutputStream out = sRes.getOutputStream();
InputStream in = null;
in = new BufferedInputStream(new FileInputStream(F));
int ch;
while ((ch = !=-1)
catch(Exception e)
if (in != null) in.close();

I agree. Here's the link:
subject: open a .exe thru servet (DLL Problem)
jQuery in Action, 3rd edition