The problem was the & I was using in the command args. The & tried to run
the process in the background, which didn't work. Removing the & allowed
the xterm to popup on the screen.
> -----Original Message-----
> From: Kelley, Jeff
> Sent: Tuesday, February 20, 2001 4:57 PM
> To: '[EMAIL PROTECTED]'
> 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: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]