This  is  a  known  problem.  There   are  plans  to  fix  it  in  the
works.  Currently there are two options:

1) Connect to any X server,by setting your display variable
   in CSH you could do 'setenv DISPLAY localhost:0.0' to connect to
   the local X  server, or however you set  your environment variables
   in your environment.  You may also  have to do a xhost +hostname if
   the hostname  is not local.  (NOTE: You don't  have to connect  to the
   *local* X server though, you can connect to any X server.)

2) If  you aren't running  X on  any nearby  servers, you  can install
   xvfb,  the virtual frame  buffer.  You  can find  a good  primer on
   getting this it at  http://tmap.pmel.noaa.gov/home/ferret/FAQ/graphics/Xvfb.html.


Paul

> Hi,
>
>    We are also getting the same problem. Our X Windows server is running. We
> are using NES and Servlet Exec. Please tell me how to set the DISPLAY
> variable and where. Is it in the start script for NES.
>
> Thanx in advance,
> Bhuvana..
>
> > ----------
> > From:         Loni & Bharat Nagwani[SMTP:[EMAIL PROTECTED]]
> > Reply To:     A mailing list about Java Server Pages specification and
> > reference
> > Sent:         Sunday, December 03, 2000 3:23 AM
> > To:   [EMAIL PROTECTED]
> > Subject:      Re: draw image
> >
> > You have to run X Windows on the server for this to work. Also in your
> > appserver startup file you have to set DISPLAY variable. If you need more
> > details send me an email and I will dig out the details tommorow.
> >
> > ----- Original Message -----
> > From: Ching sen, Jackson <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Sunday, November 26, 2000 4:29 AM
> > Subject: draw image
> >
> >
> > > hi all,
> > >
> > > I copy this draw image servlet from a book
> > >
> > > import java.io.*;
> > > import java.awt.*;
> > > import javax.servlet.*;
> > > import javax.servlet.http.*;
> > >
> > > import Acme.JPM.Encoders.GifEncoder;
> > >
> > > public class HelloWorldGraphics extends HttpServlet {
> > >
> > >   public void doGet(HttpServletRequest req, HttpServletResponse res)
> > >                                throws ServletException, IOException {
> > >     ServletOutputStream out = res.getOutputStream();  // binary output!
> > >
> > >     Frame frame = null;
> > >     Graphics g = null;
> > >
> > >     try {
> > >       // Create an unshown frame
> > >       frame = new Frame();
> > >       frame.addNotify();
> > >
> > >       // Get a graphics region, using the Frame
> > >       Image image = frame.createImage(400, 60);
> > >       g = image.getGraphics();
> > >
> > >       // Draw "Hello World!" to the off screen graphics context
> > >       g.setFont(new Font("Serif", Font.ITALIC, 48));
> > >       g.drawString("Hello World!", 10, 50);
> > >
> > >       // Encode the off screen image into a GIF and send it to the
> > client
> > >       res.setContentType("image/gif");
> > >       GifEncoder encoder = new GifEncoder(image, out);
> > >       encoder.encode();
> > >     }
> > >     finally {
> > >       // Clean up resources
> > >       if (g != null) g.dispose();
> > >       if (frame != null) frame.removeNotify();
> > >     }
> > >   }
> > > }
> > >
> > > but I got this error message, pls tell me how to fix it.
> > >
> > > java.lang.InternalError: Can't connect to X11 window server using ':0.0'
> > as the value of the DISPLAY variable.
> > >  at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
> > >  at sun.awt.X11GraphicsEnvironment.(X11GraphicsEnvironment.java:58)
> > >  at java.lang.Class.forName0(Native Method)
> > >  at java.lang.Class.forName(Class.java:120)
> > >  at
> > java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironme
> > nt
> > .java:59)
> > >  at sun.awt.motif.MToolkit.(MToolkit.java:56)
> > >  at java.lang.Class.forName0(Native Method)
> > >  at java.lang.Class.forName(Class.java:120)
> > >  at java.awt.Toolkit$2.run(Toolkit.java:495)
> > >  at java.security.AccessController.doPrivileged(Native Method)
> > >  at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:488)
> > >  at java.awt.Window.getToolkit(Window.java:416)
> > >  at java.awt.Frame.addNotify(Frame.java:270)
> > >  at HelloWorldGraphics.doGet(HelloWorldGraphics.java:20)
> > >  at javax.servlet.http.HttpServlet.service(HttpServlet.java:715)
> > >  at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
> > >  at
> > com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:155)
> > >  at com.sun.web.core.InvokerServlet.service(InvokerServlet.java:168)
> > >  at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
> > >  at
> > com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:155)
> > >  at com.sun.web.core.Context.handleRequest(Context.java:414)
> > >  at com.sun.web.server.ConnectionHandler.run(ConnectionHandler.java:139)
> > >
> > >
> > ==========================================================================
> > =
> > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > > Some relevant FAQs on JSP/Servlets can be found at:
> > >
> > >  http://java.sun.com/products/jsp/faq.html
> > >  http://www.esperanto.org.nz/jsp/jspfaq.html
> > >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
> > ==========================================================================
> > =
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.html
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to