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

Kevin Baynes kbaynes at renex.com
Thu Mar 15 10:04:01 PST 2001


Jonathan-

AppletViewer is doing you a favor by not respecting your local classpath,
because client machines won't either.

Since your applet clients probably won't have JDOM installed on their
systems, you'll need to download JDOM to them with the applet. You can do
this by using Download Extensions, there's a tutorial here:

http://java.sun.com/docs/books/tutorial/ext/basics/download.html

-Kevin Baynes


-----Original Message-----
From: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]On Behalf Of Wesley Biggs
Sent: Wednesday, March 14, 2001 6:25 PM
To: 'J Graham'; jdom-interest at jdom.org
Subject: RE: [jdom-interest] Applets and JDOM again - Help.


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
_______________________________________________
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