CLASSPATH question

From: john smith (princetonharvard_at_charter.net)
Date: 02/26/05

  • Next message: bunallo: "Remove key based on value in Hashtable"
    Date: Fri, 25 Feb 2005 17:06:00 -0800
    
    

    If I have *.JAR files in the same directory that I am compiling my java code
    do I have to include a classpath.

    will the JAVA compiler go to the *JAR files in the current directory to find
    the org.apache and orl.xml.sax as noted in the
    code below?

    The reason I ask the question, I put some *.JAR files in my class path that
    really messed something up because
    I could no longer run my java programs. My java programs would compile, but
    they would not run. It was if
    the computer had trouble locating the *.class file. I ended up having to
    reinstall the JAVA distribution then everything was ok again.
    Yes it was just really strange.

    So, I thought I would just forget about the class path and put the *JAR
    files in the path I am compiling. But I'm not sure if this is correct.

    Please help. Thanks

    package sax;

    import org.apache.*;
    import org.xml.sax.*;

    public class ParseDoc {

       public static void main( String[] args) throws Exception {
            XMLReader reader = new SAXParser();
     reader.setContentHandler( new Handler() );
     reader.parse("mydata.xml");
     }

    }

    class Handler implements ContentHandler {

    public void setDocumentLocator( Locator locator) {}
    public void startDocument()
    {

     System.out.print("Start");

    }
    public void endDocument() {}
    public void startElement(String namespace, String name, String qName,
    Attributes atts){}
    public void endElement(String namespace, String name, String qName) {}
    public void characters( char[] ch, int start, int length) {}
    public void processingInstruction( String target, String data){}
    public void startPrefixMapping(String prefix, String uri ){}
    public void endPrefixMapping( String prefix) {}
    public void ignorableWhitespace( char[] ch, int start, int length ) {}
    public void skippedEntity(String name ) {}

    }


  • Next message: bunallo: "Remove key based on value in Hashtable"

    Relevant Pages