I tried the code in Windows, jdk 1.4.0.1 (or something like that,
the latest one), tomcat 4.0.4 and it works :)

         I cant elaborate :)

         And as far as I know you can use AWT to create images and stuff in
JSP and servlets...

         my guess is that something is missing from the classpath, awt ?

         tiago



At 05:09 PM 9/3/2002 +0530, you wrote:
>I tried your code and got the same error.
>
>I doubt if we can use awt classes in a jsp ! AWT and Swing classes are all
>used to generate graphical applications !
>
>Trying to get the graphical environment in jsp/servlet environment... not
>sure
>whether this is possible / even valid.
>
>Lakew, I am also interested to know how you ran the jsp... please
>elaborate...
>(I used WebSphere in Linux to test the jsp).
>
>(is it a problem in the classpath?)
>
>Dayanand.
>
>-----Original Message-----
>From: A mailing list about Java Server Pages specification and reference
>[mailto:[EMAIL PROTECTED]]On Behalf Of VTR Ravi Kumar
>Sent: Tuesday, September 03, 2002 4:29 PM
>To: [EMAIL PROTECTED]
>Subject: Re: sun/awt/X11GraphicsEnvironment not found (please try this
>and guide me of where i went wrong)
>
>
>please elaborate,
>
>vtr
>
>
>
>At 05:32 PM 9/3/02 +0800, you wrote:
> >Hi,
> >     I have tested your source, it's correct, I think the java path is
>error
> >   ----- Original Message -----
> >   From: VTR Ravi Kumar
> >   To: [EMAIL PROTECTED]
> >   Sent: Tuesday, September 03, 2002 16:58
> >   Subject: sun/awt/X11GraphicsEnvironment not found (please try this and
> > guide me of where i went wrong)
> >
> >
> >   This is the error which i get when I try to generate a random title
> > using the source given at the end can anyone tell what the problme might
>be.
> >
> >
> >   java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment
> >   at java.lang.Class.forName0(Native Method)
> >   at java.lang.Class.forName0(Compiled Code)
> >   at java.lang.Class.forName(Compiled Code)
> >   at
> >
>java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment
>.java:63)
> >   at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1009)
> >   at java.awt.image.BufferedImage.getGraphics(BufferedImage.java:998)
> >   at test.aa_1._jspService(Compiled Code)
> >   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> >   at javax.servlet.http.HttpServlet.service(HttpServlet.java)
> >   at
> > org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574)
> >   at org.apache.tomcat.core.Handler.invoke(Compiled Code)
> >   at org.apache.tomcat.core.Handler.service(Compiled Code)
> >   at
>org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)
> >   at org.apache.tomcat.core.ContextManager.internalService(Compiled Code)
> >   at org.apache.tomcat.core.ContextManager.service(Compiled Code)
> >   at
> >
>org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Compile
>d
> > Code)
> >   at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Compiled Code)
> >   at
> > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Compiled
>Code)
> >   at java.lang.Thread.run(Thread.java:485)
> >
> >
> >   source
> >
> >   xyz.jsp
> >
> >   <html><head><title>Dynamic Title</title></head>
> >   <%@ page language="java" import="java.sql.*" %>
> >   <%@ page
> >
>import="java.io.*,java.awt.*,java.awt.image.*,com.sun.image.codec.jpeg.*,jav
>a.util.*"
> > %>
> >   <%@ page session="true" buffer="8kb" autoFlush="true"
> > errorPage="except.jsp" isErrorPage="false" isThreadSafe="true"%>
> >   <%
> >   response.setContentType("image/jpeg");
> >   int width=780, height=50,col=256;
> >   BufferedImage image = new BufferedImage(width, height,
> > BufferedImage.TYPE_INT_RGB);
> >   Graphics g = image.getGraphics();
> >   Random random = new Random();
> >   g.setColor(new Color(218,254,random.nextInt(height)+200));
> >   g.fillRect(0, 0, width, height);
> >   Polygon poly = new Polygon();
> >   for (int i=0; i < 20; i++) {
> >   poly.addPoint(random.nextInt(width),random.nextInt(height));
> >   }
> >   g.setColor(new
> > Color(random.nextInt(height),random.nextInt(col),random.nextInt(col)));
> >   g.fillPolygon(poly);
> >   g.setColor(new
> >
>Color(random.nextInt(col),random.nextInt(col),random.nextInt(height)+200));
> >   g.setFont(new Font("Serif",Font.ITALIC,48));
> >   g.drawString("INTERNATIONAL CLUB",60,40);
> >   g.dispose();
> >   ServletOutputStream sos =response.getOutputStream();
> >   JPEGImageEncoder encoder =JPEGCodec.createJPEGEncoder(sos);
> >   encoder.encode(image);
> >   %>
> >   </body>
> >
> >   regards
> >
> >   vtr
> >
> >
> >     V.T.R.Ravi Kumar
> >     Engineer, ITX,
> >     Bharat Heavy Electrical Ltd.,
> >   =====================================================================
> >
> >   Krodhad bhavati  Sammoha
> >   Sammohat smritivibrahmah
> >   Smritivibrahmat buddinaso
> >   Buddhinasat pranasyati
> >       -Bhagvatgita
> >   "Anger results in delusion, delusion leads to loss in memory,
> >   memory loss leads to knowledge loss, If knowledge is lost you perish"
> >
> >   =====================================================================
> >
> >
> >===========================================================================
>  > 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://archives.java.sun.com/jsp-interest.html
> >http://java.sun.com/products/jsp/faq.html
> >http://www.esperanto.org.nz/jsp/jspfaq.jsp
> >http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
> >
> >
> >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://archives.java.sun.com/jsp-interest.html
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> >  http://www.jguru.com/faq/index.jsp
> >  http://www.jspinsider.com
>
>
>V.T.R.Ravi Kumar
>Engineer, ITX,
>Bharat Heavy Electrical Ltd.,
>=====================================================================
>Krodhad bhavati  Sammoha
>Sammohat smritivibrahmah
>Smritivibrahmat buddinaso
>Buddhinasat pranasyati
>-Bhagvatgita
>"Anger results in delusion, delusion leads to loss in memory,
>memory loss leads to knowledge loss, If knowledge is lost you perish"
>=====================================================================
>
>===========================================================================
>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://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
>
>===========================================================================
>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://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

cya,

Tiago Nodari
www.nodari.org

===========================================================================
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to