The path ("images/aaa.bbb") in constructor
   new FileWriter("images/aaa.bbb")
is incorrect. Try to give it a full path like c:/jakarta-tomcat/xxx/xxx.



-----Original Message-----
From: A mailing list about Java Server Pages specification and reference 
[mailto:[EMAIL PROTECTED]]On Behalf Of Hoang Manh Hung
Sent: Thursday, March 29, 2001 5:47 PM
To: [EMAIL PROTECTED]
Subject: Need help on Tomcat / Servlet


Hi all,

I'm working on Tomcat 3.2.1 / Java servlet and I want to create a new file within a 
servlet's body. My command is:

BufferedWriter  writer = new BufferedWriter(new FileWriter("images/aaa.bbb"));

and the server throws back an error like:

java.io.FileNotFoundException: images/aaa.bbb (The system cannot find the path 
specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:102)
at java.io.FileOutputStream.(FileOutputStream.java:62)
at java.io.FileWriter.(FileWriter.java:38)
at test2.doGet(test2.java:32)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)


However, the line of code belows can run OK:

        out.println("<html>");
        out.println("<body>");
        out.println("<head>");
        out.println("<title>Hello World!</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<h1>Hello World, this is 1st one!</h1>");
        out.println("<img src=\"images/news_thumb1.jpg\">");
        out.println("</body>");
        out.println("</html>");


Can anyone of you help me to solve that?

Many thanks in advance!
HungHM.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
:   gʋ~&ܢfva _j 
(&

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to