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(Compiled 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.*,java.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

Reply via email to