[jdom-interest] Applets and JDOM again - Help.

Wesley Biggs wbiggs at elite.com
Wed Mar 14 18:25:25 PST 2001


Jonathan,

appletviewer doesn't automatically respect your classpath environment
variable.

You need something like

> appletviewer -J"-classpath
.;d:\dev\xerces-1_3_0\xerces.jar;d:\dev\jdom-b6\lib\jdom.jar"
GameStatsLive.html

Wes

-----Original Message-----
From: J Graham [mailto:jkgraham at plasmic360.com]
Sent: Wednesday, March 14, 2001 6:09 PM
To: jdom-interest at jdom.org
Subject: [jdom-interest] Applets and JDOM again - Help.


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;
   }
 }
}


_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com



More information about the jdom-interest mailing list