Parthasarathi
March 2nd, 2000, 01:54 AM
Hi all,
I am geting the ClassFormatError. Can anybody
suggest what is the cause. Code is ttatched below.
Thanks.
import java.applet.*;
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import java.awt.event.*;
import java.net.*;
import java.lang.Math;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import Acme.JPM.Encoders.GifEncoder;
import Acme.MainFrameModified; //Downloaded from O'Reilly site.
public class VerticalText5 extends HttpServlet{
static final int WIDTH =900;
static final int HEIGHT = 350;
static final String APPLETNAME = "BarGraph"; // An applet I have written,
public void doGet(HttpServletRequest Rqst, HttpServletResponse Rspn)
throws ServletException, IOException
{
System.out.println("Begin doGet ..........");
ServletOutputStream out = Rspn.getOutputStream();
MainFrameModified frame = null;
Applet applet = null;
Graphics g = null;
try {
try{
applet = (Applet) Class.forName(APPLETNAME).newInstance();
System.out.println(APPLETNAME+" Applet loaded Successfully !!!");
}
catch (Exception e)
{
throw new ServletException("Could not load Applet : "+ e);
}
String args[] = new String[1];
args[0]="barebones=true";
frame = new MainFrameModified(applet, args, WIDTH, HEIGHT);
Image image = frame.createImage(WIDTH,HEIGHT);
g = image.getGraphics();
System.out.println("Got the Graphics context");
applet.validate();
applet.paint(g);
Rspn.setContentType("image/gif");
GifEncoder encoder = new GifEncoder(image, out);
encoder.encode();
}
finally{
if (applet != null) {applet.stop(); applet.destroy(); applet.removeAll();}
if (g!= null) g.dispose();
if (frame != null) {
frame.removeAll();
frame.removeNotify();
frame.dispose();
}
}
}
}
I am geting the ClassFormatError. Can anybody
suggest what is the cause. Code is ttatched below.
Thanks.
import java.applet.*;
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import java.awt.event.*;
import java.net.*;
import java.lang.Math;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import Acme.JPM.Encoders.GifEncoder;
import Acme.MainFrameModified; //Downloaded from O'Reilly site.
public class VerticalText5 extends HttpServlet{
static final int WIDTH =900;
static final int HEIGHT = 350;
static final String APPLETNAME = "BarGraph"; // An applet I have written,
public void doGet(HttpServletRequest Rqst, HttpServletResponse Rspn)
throws ServletException, IOException
{
System.out.println("Begin doGet ..........");
ServletOutputStream out = Rspn.getOutputStream();
MainFrameModified frame = null;
Applet applet = null;
Graphics g = null;
try {
try{
applet = (Applet) Class.forName(APPLETNAME).newInstance();
System.out.println(APPLETNAME+" Applet loaded Successfully !!!");
}
catch (Exception e)
{
throw new ServletException("Could not load Applet : "+ e);
}
String args[] = new String[1];
args[0]="barebones=true";
frame = new MainFrameModified(applet, args, WIDTH, HEIGHT);
Image image = frame.createImage(WIDTH,HEIGHT);
g = image.getGraphics();
System.out.println("Got the Graphics context");
applet.validate();
applet.paint(g);
Rspn.setContentType("image/gif");
GifEncoder encoder = new GifEncoder(image, out);
encoder.encode();
}
finally{
if (applet != null) {applet.stop(); applet.destroy(); applet.removeAll();}
if (g!= null) g.dispose();
if (frame != null) {
frame.removeAll();
frame.removeNotify();
frame.dispose();
}
}
}
}