• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Applets and Parsers, Oh My!

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Applet and SAX Greenhorn
I getting an error message:
"Exception occurred during event dispatching:"
"java.lang.NoClassDefFoundError: org/xml/sax/SAXException"
I am running an applet that instanciates a class that utilizes a SAX parser (Xerces). Normally, this looks like I do not have my "classpath" set, but I have set my class path to the xerces.jar file and tried to move the xerces.jar file to where I am running the applet, with out any different results.
I created an application that instanciates the above class that uses SAX and everything work great. It is just when I try to instanciate the class that uses SAX in an applet, I get the above error message.
Is there something I am missing with applets?
Do I need to move the xerces's JAR files to a different location for applets?
Below is the applet code:
//
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
import org.apache.xerces.parsers.SAXParser;
import java.io.*;
import SAXPCTestApp;
public class WholeTest2 extends JApplet implements ActionListener {
// graphical components defined
private JLabel parentfileLabel;
private TextField parentfileField;
private String parentfileOut;
// setup of graphical interface components.
public void init()
{
// components can be attached to.
Container c = getContentPane();
// each GUI component on the Pane.
c.setLayout( new FlowLayout() );
// Parent file
parentfileLabel = new JLabel("Enter Parent file name:");
c.add(parentfileLabel);
parentfileField = new TextField(30);
c.add(parentfileField);
// Button
Button ButtonField = new Button("Process Data");
ButtonField.addActionListener(this);
c.add(ButtonField);
//xxx();
}
// Action event to perform when Enter key is pressed.
public void actionPerformed( ActionEvent a)
{
try {
xxx();
}
catch (Exception e)
{
System.out.println("Error reading URI: " + e.getMessage());
}
//System.exit(0);
}
public static void xxx() throws Exception, IOException, SAXException {
try{
System.out.println("In xxx method");
// THE NEXT LINE IS WHERE I GET THE ERROR MESSAGE
SAXPCTestApp qqq = new SAXPCTestApp();
System.out.println("In xxx method, after instanciation");
String pOut = "O1.xml";
// IF I COMMENT OUT THE ABOVE ERROR LINE, I WOULD GET THE ERROR HERE
SAXPCTestApp.SAXPCTestAppA(pOut);
}
catch (Exception e)
{
System.out.println("Error reading URI: " + e.getMessage());
}
System.out.println("Leaving xxx method");
}
}
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic