It is generally unwise ever to name anything "test" in UNIX.  There is a
'test' command in UNIX for comparing strings and checking the existance of
files, directories, etc.  If you execute the UNIX 'test' command with no
arguments it returns a negative value (non-zero in UNIX).  Suggest you
change the name of your class to "Mytest" or something other than "test"
Dick S.



At 09:40 AM 2/22/2000 +0100, you wrote:
>Hi,
>
>I have a problem in my Servlets.  I need to execute commands from inside my
>servlets.  I can execute commands from the shell by using "java comline"...
>and this works fine.
>
>import java.io.*;
>
>public class comline {
>   public static void main(String[] arguments)   {
>     try {
>         Runtime.getRuntime().exec("mkdir ItWorked");
>     } catch(IOException ex) {
>         System.err.println("IOException : " + ex.getMessage());
>     }
>   }
>}
>
>However the following code.......
>
>import javax.servlet.http.*;
>import javax.servlet.ServletException;
>import java.io.*;
>import java.util.*;
>
>public class test extends HttpServlet {
>
>  public void doGet(HttpServletRequest request, HttpServletResponse
>response)throws IOException
>
>
>    HttpSession UserSession = request.getSession(true);
>    response.setContentType("text/html");
>    PrintWriter out = response.getWriter();
>
>    out.println("<HTML>");
>    out.println("<BODY>");
>    out.println("<h5>Current Date : " + new Date() + "</h5>");
>
>    try {
>         Runtime.getRuntime().exec("mkdir ItWorked");
>     } catch(IOException ex) {
>         System.err.println("IOException : " + ex.getMessage());
>    }
>    out.println("</body></html>");
>    out.close();
>  }
>}
>
>This does not work.  My system setup is.  SuSE 6.3 i386, apache 1.3.11 with
>jserv 1.1.
>
>Does anyone know why this command will not execute?
>
>Some possible reasons I have looked at are :
>1.  Setting the user to somebody other than nobody and then giving ownership
>of the directory to them.
>2.  Path to mkdir not set.
>
>However none of these changes made any effect.  Another intresting thing is
>it reports no error's.  However if I try and use .....
>
>         Runtime.getRuntime().exec("java comline");
>
>From inside the servlet, it report the error that it can't find the file
>java.  It obviously doesn't use the same path's as bash.  I am stumped can
>anyone help me?
>
>Thanks,
>
>Keith
>---------------------------------------------------------------------------
>Keith Ball - Praktikant
>WA46 Operationelle  Analysen  Luftwaffe
>IABG MbH       Einsteinstr. 20      85521 Ottobrunn
>Phone : 0049-89-6088-2556
>Email : [EMAIL PROTECTED]         WWW site : www.iabg.de
>----------------------------------------------------------------------------
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
-
@----------------------------------------------------------------)
 |  [EMAIL PROTECTED] __,     Anne Arundel          |
 |   (410)541-2424               []:-) Community College        |
 |  http://enterprise.aacc.cc.md.us/~rhs  Speed the Net!        |
@----------------------------------------------------------------)

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to