----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files. Don't make us guess your problem!!!
----------------------------------------------------------------
> >
> > Servlets may do everything like a standalone Java
> Application. They're
> > running on the server and are programmed by people who are
> supposed to
> know
> > what they do (ha ha).
>
> What you said is absolutely NOT true. Have you ever read any
> book on servlet
> programming? There are restrictions. By the way I do know how
> to program.
Sorry, I didn't intend to insult you. It was meant more ironically. I'm just
a newbie to programming, so i didn't mind to tell how good i am and how bad
you are.
So please accept my apology.
No, i didn't read a book about servlet to the end, mostly because everything
is working just fine.
I don't know, which restrictions you mean, Java itselfs has
security-restrictions, yes. But i don't know, if servlets has special ones.
But i know surely that servlets my work with files just like every normal
application. I can create, read, rename, write, everything. So it couldn't
be that a servlet have restrictions in file IO. There must be a permission
problem or a configuration problem.
My two cent about this.
Regards
Clemens
>
> > Give your error messages or example code so we can see
> what's going wrong.
>
> There is NO error message. I even tried using external
> commands from Java.
> Only "ls or finger" works
>
> Here is the code for the servlet which does not work.
>
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> public class testRename extends HttpServlet
> {
> public void init(ServletConfig config) throws ServletException
> {
> super.init(config);
> }//end init
>
> public void doPost( HttpServletRequest req, HttpServletResponse res)
> throws ServletException, IOException
> {
> doGet(req, res);
> }
>
> public void doGet( HttpServletRequest req, HttpServletResponse res)
> throws ServletException, IOException
> {
> PrintWriter out = res.getWriter();
> res.setContentType("text/html");
> File file1 = new File("/projects/lemonade/test","temp1.html");
> File file2 = new File("/projects/lemonade/test","TEMP1.html");
> if (file1.renameTo(file2))
> out.println ("succeeded");
> else
> out.println ("failed");
> out.close ();
> } // doGet
>
> } // end of calss testRename
>
>
> Here is the code for Standalone application, which works.
> import java.io.File;
>
> class Mv {
> public static void main(String[] args) {
> if (args.length != 2) {
> System.err.println("Usage: java Mv <file1> <file2>");
> System.exit(-1);
> }
> File f1 = new File(args[0]);
> File f2 = new File(args[1]);
>
> if (f1.equals(f2)) {
> System.err.println("Cannot rename a file to itself");
> System.exit(-1);
> }
> System.out.println(f1.getPath() +
> (f1.renameTo(f2) ? " renamed to " : " could not be
> renamed to ")
> +
> f2.getPath());
>
> // check f1 and f2: their path and hash codes remain unchanged
> System.out.println("f1: " + f1.toString() + " " +
> f1.hashCode());
> System.out.println("f2: " + f2.toString() + " " +
> f2.hashCode());
> }
> }
>
>
>
>
>
>
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Archives and Other: <http://java.apache.org/main/mail.html>
> Problems?: [EMAIL PROTECTED]
>
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]