You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Benjamin Jones <be...@integretechpub.com> on 2004/03/30 21:40:45 UTC

Search path for classes given in arguments of XMLReaderFactory.createXMLReader( )

This following code generates a ClassNotFoundException, but only from an 
applet, and only on line 10.  This seems to imply that the search path 
for classes given as a string in the argument of CreateXMLReader is 
different from the search path for classes instaniated in the method.

Can somebody tell me how to put "org.apache.xerces.parsers.SAXParser" in 
the appropriate search path for the CreateXMLReader method?

Thanks,




1   public String xpath(String xml, String xpath) {
2       String result = "";
3        SAXSource xmlsrc=new SAXSource(new InputSource(new 
StringReader(xml)));
4        XMLReader newRead = null;
5        org.apache.xerces.parsers.SAXParser Monkey=new
6             org.apache.xerces.parsers.SAXParser();
7        System.out.println(Monkey.getClass());
8           try{
9            newRead=
10                 
XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
11             }
12         catch (Exception e){
13          e.printStackTrace(System.err);
14           return (null);
15         }
        


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Search path for classes given in arguments of XMLReaderFactory.createXMLReader( )

Posted by purushotham <pu...@yahoo.com>.
Hi,
 
This is a common problem with applet. Even if you try to use JDBC you will face the same class not found exception. All you have to do is pack all the required jars together with your java classes into one singe zip (Zip file name must be same as of your java class). After this add the archive attribute to applet tag 
 
  <applet class=<classname> archive=<zipname> ... >
 
Purushotham

Benjamin Jones <be...@integretechpub.com> wrote:
This following code generates a ClassNotFoundException, but only from an 
applet, and only on line 10. This seems to imply that the search path 
for classes given as a string in the argument of CreateXMLReader is 
different from the search path for classes instaniated in the method.

Can somebody tell me how to put "org.apache.xerces.parsers.SAXParser" in 
the appropriate search path for the CreateXMLReader method?

Thanks,




1 public String xpath(String xml, String xpath) {
2 String result = "";
3 SAXSource xmlsrc=new SAXSource(new InputSource(new 
StringReader(xml)));
4 XMLReader newRead = null;
5 org.apache.xerces.parsers.SAXParser Monkey=new
6 org.apache.xerces.parsers.SAXParser();
7 System.out.println(Monkey.getClass());
8 try{
9 newRead=
10 
XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
11 }
12 catch (Exception e){
13 e.printStackTrace(System.err);
14 return (null);
15 }



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.