Hi vtr:

According to the docs on NoClassDefFoundError:

Thrown if the Java Virtual Machine or a classloader tries to load in the definition of a class (as part of a normal method call or as part of creating a
new instance using the new expression) and no definition of the class could be found.

The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.

When I encountered this problem recently I found that I had a problem with my classpath: the class the complaint was about (in your case it'd be X11GraphicsEnvironment..) was in two different packages in my classpath. I changed the code for the reference of that class and I was ok then. (Make sure you "build all" too..)

Regards,
Geeta

VTR Ravi Kumar wrote:

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, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to