tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Layman <randy.lay...@aswethink.com>
Subject RE: servlet not quite working
Date Tue, 20 Feb 2001 21:37:00 GMT

	Does nobody@webserver have permission to open a X session on the
remove computer?  Are you making some provision to keep this reference to
Process p alive so that it won't get garbage collected (and kill the
process) once the method completes?

	Randy

-----Original Message-----
From: Kelley, Jeff [mailto:kelly@retrotech.com]
Sent: Tuesday, February 20, 2001 4:57 PM
To: 'tomcat-user@jakarta.apache.org'
Subject: servlet not quite working


I am trying to run a servlet that will pop an xterm up on the remote
computer.  I do not get an error when compiling or calling the servlet, but
I don't get the xterm to pop up.  

Here is the java file I am using:

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;
import javax.servlet.*;
import javax.servlet.http.*;


public class TestServlet extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse
response)
        throws ServletException, IOException
    {
        PrintWriter out = response.getWriter();
        response.setContentType("text/plain");

        // Create command sring to run on server. request.getRemoteAddr()
will
        // get you the ip address of the remote machine. The :0 sets the
display
 number
        //
        String[] callAndArgs = { "/usr/bin/X11/xterm",
        "-display " + request.getRemoteAddr() + ":0 &" };

        // Some output to what we are doing
        out.println("Test Servlet");
        out.println("Remote Addr: " + request.getRemoteAddr());
        out.println("Remote Command: " + callAndArgs[0]);
        out.println("Remote Command Args: " + callAndArgs[1]);

        out.println("If this works you should see an xterm");
        out.println("Is you xserver running?( exceed maybe)");

        // Get a our runtime object, then execute a process using our
command st
ring
        Runtime rt = Runtime.getRuntime();
        Process p = rt.exec(callAndArgs);

    }
}

and here is the output I get:

Test Servlet Remote Addr: "correct ip address"
Remote Command: /usr/bin/X11/xterm 
Remote Command Args: -display "correct ip address":0 & 
If this works you should see an xterm 
Is you xserver running?( exceed maybe) 

Any ideas as to why I never get the actual xterm to popup on my computer?  


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, email: tomcat-user-help@jakarta.apache.org

Mime
View raw message