I'm fairly new to Java, and as a result I'm having major problems getting my packages to be recognized when I compile the programs.

I'm trying to install a sax parser (I downloaded it from a link from the website)

The file is sax2r2.jar
and is located at C:\j2sdk1.4.2_02\sax2r2.jar

When I installed xerces, it said to do a jar -xf <file> to install it, so I did the same with this sax file
c:\j2sdk1.4.2_02> jar -xf sax2r2.jar

Which creates the following directory:

Which in turn has sax.jar

and to subfolders apidoc and src

within C:\j2sdk1.4.2_02\sax2.0.1\src\ there is a subfolder org

Here is my CLASSPATH variable specified in the User section of the Environment Variables section of the System configuration option in Windows XP Professional (Up to date with all patches/service packs if that matters).

Here is my CLASSPATH variable

Here is my PATH variable
C:\jwsdp-1.2\jwsdp-shared\bin;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;C:\j2sdk1.4.2_02\bin;

when I'm attempting to javac my program, c:\VectorProject\
 * Created on October 20, 2003, 1:04 PM

 * @author  Shoeman22
import java.util.*;
//import org.w3c.dom.Document;
import javax.naming.*;
import javax.xml.parsers;
import org.xml.*;

import org.dom4j.Document;
import org.dom4j.DocumentException;

public class Parse {
    String url;
    Vector myVector;
    Document document;
    /** Creates a new instance of Parse */
    public Parse(String u) {
        url = u;
        myVector = new Vector();
        document = this.returnXML();
    private Document returnXML() throws DocumentException {
        SAXReader reader = new SAXReader();
        Document document =;
        return document;
    public void process() {
        List list = document.selectNodes( "//svg/line" );

        for (Iterator iter = list.iterator(); iter.hasNext(); ) {
            Attribute attribute = (Attribute);
            String url = attribute.getValue();

when I run, from the command prompt, c:\VectorProject > javac
I get the following errors:
------------------------------------------------------------------------------------------------------------- package javax.xml does not exist
import javax.xml.parsers;
                        ^ package org.xml does not exist
import org.xml.sax;
                     ^ cannot resolve symbol
symbol : class Attribute
location: class Parse
                  Attribute attribute = <Attribute>;
                  ^ cannot resolve symbol
symbol : class Attribute
location: class Parse
                    Attribute attribute = <Attribute>;

4 errors
I assume this is a real easy fix, but I've been tearing my hair out trying to get this to work for the past couple of days, so any assistance would be greatly appreciated.

If you could just specify what exactly I should have for my CLASSPATH and PATH variables I'd really appreciate it.  I did do a search here prior to posting this and saw a thread stating the the CLASSPATH is basically a root directory for your import statements to append to...hence why I assumed my CLASSPATH entry: C:\j2sdk1.4.2_02\sax2.0.1\sax.jar;C:\j2sdk1.4.2_02\sax2.0.1\src\ would work correctly.

Thanks for the help,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Should probably be:

import javax.xml.parsers.*;
import javax.xml.sax.*;

import org.xml.sax.*;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shoeman22Author Commented:
Thank you, that cleared up the first 2 errors involving the importing, but I'm still getting the bottom 2 errors resulting from the Attribute class not being found...

What else do I need to import/install in order to eliminate the Attribute symbol not resolved error?
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

savalouCommented: Attribute a dom4j class?  I'm guessing then you need an

import org.dom4j.Attribute;

shoeman22Author Commented:
I did this and it worked.

so I changed my import list to:
import java.util.*;
//import org.w3c.dom.Document;
//import javax.naming.*;
//import javax.xml.parsers.*;
//import org.xml.sax.*;
//import org.dom4j.Document;
//import org.dom4j.DocumentException;
import org.dom4j.*;

Thanks for the other thing...when I compiled the program, it gave me 26 warnings regarding deprecation relating to dom4j and sax, but it still that a something to be concerned about?

>> when I compiled the program, it gave me 26 warnings regarding deprecation relating to dom4j and sax, but it still that a something to be concerned about?

Not for the moment, if everything works...some deprecated Java SDK methods throw an IllegalArgumentException or something if try to use them (java.util.Date does/did that a lot).  You should probably look at the javadoc of the deprecated methods to find out why they are deprecated and what to do about it.

But, nah, live dangerously!
shoeman22Author Commented:
Good to know,
Thank you very much for your help savalou!
I already accepted your answer, but while I've got your attention...

Do you know how to make Netbeans recognize my imports as valid packages?

Also, I just went to and found NetBeans...are there better programs for development, or is Netbeans the preferred?

Thanks again,
Well, you've got my attention as long as this thing keeps e-mailing me...

Personally, I use NetBeans myself and I like it.  I've also had colleagues tell me Eclipse is good, I've never tried it much.  These two are free, so what's not to like?  

I don't know what you mean by "make Netbeans recognize my imports as valid packages".  If you mean that it complains about
import org.xml.sax.*;
when you try to compile your code, that's because you have to mount sax.jar in the FileSystem (right-click on filesystem, click on mount, ...).  

Alright?  Any more questions, buddy, and you'll have to pay me mucho dinero!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.