tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kelley, Jeff" <ke...@retrotech.com>
Subject servlet not quite working
Date Tue, 20 Feb 2001 21:56:58 GMT
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?  


Mime
View raw message