[jdom-interest] Applets and JDOM again - Help.
J Graham
jkgraham at plasmic360.com
Wed Mar 14 18:09:10 PST 2001
Hi,
I've read through all of the jdom-interest archives and have tried the few
solutions provided, but none seem to work. My small snippet of code works
as an application, but gives the following error when run
using appletviewer:
java.lang.NoClassDefFoundError: org/jdom/input/SAXBuilder
at GameStatsLive.start(GameStatsLive.java:26)
at sun.applet.AppletPanel.run(AppletPanel.java:358)
at java.lang.Thread.run(Thread.java:484)
Below is the code. Simply comment out the "Applet Version" lines and
un-comment the "Stand alone version" lines to see it work fine as an
application. Any help would be greatly appreciated!
Thanks much!
-Jonathan Graham
My CLASSPATH:
CLASSPATH=.;d:\dev\xerces-1_3_0\xerces.jar;d:\dev\jdom-b6\lib\jdom.jar
======================
import java.net.*;
import java.io.*;
import org.jdom.*;
import org.jdom.input.*;
import java.applet.Applet; // Applet Version
public class GameStatsLive extends Applet { // Applet Version
//public class GameStatsLive { // Stand alone version
public void start() { // Applet Version
//public static void main ( String args[] ) { // Stand alone version
URL statsURL;
try {
statsURL = new URL("http://www.plasmic360.com/gamestats.xml");
} catch (MalformedURLException e) {
System.out.println("MalformedURL: " + e.getMessage());
return;
}
try
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(statsURL);
Element rootelm = doc.getRootElement();
String vscore = rootelm.getChild("score")
.getChild("visitor")
.getText();
System.out.println("Visitor: " + vscore);
} catch (Exception e)
System.out.println("Caught Exception: " + e.getMessage());
return;
}
}
}
More information about the jdom-interest
mailing list