• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

open a .exe from server(DLL problem, urgent)

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
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 .
thks
Kamal J
kamaalj@usa.net

here is the code)

import java.io.*;
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);
sRes.setContentType("application/octet-stream");
//the next statement is the most IMPORTANT statement
sRes.setHeader("Content-Disposition", "attachment;filename=\"" + fileWanted +"\"");
ServletOutputStream out = sRes.getOutputStream();
InputStream in = null;
try
{
in = new BufferedInputStream(new FileInputStream(F));
int ch;
while ((ch = in.read()) !=-1)
{
out.print((char)ch);
}
}
catch(Exception e)
{
System.out.println(e.toString());
}
finally
{
if (in != null) in.close();
}

}
}
 
Is this the real life? Is this just fantasy? Is this a tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic