[jdom-interest] Iterator class conflict

Laymon, Marc A (CRD) laymon at crd.ge.com
Tue Dec 18 08:09:23 PST 2001


I have downloaded beta 7 of the jdom package.  I am using ant to try
to compile a collegue's code.  I put the directory with
all the beta 7 jdom jars in my build classpath.  However, when
javac tries to compile a file, it gives the following error:

[javac] /home/projects/xml/XMLConfig.java:277: incompatible types
    [javac] found   : com.sun.java.util.collections.Iterator
    [javac] required: java.util.Iterator
    [javac] 	Iterator variables = root.getChildren ( "variable" ).iterator () ; 

This is the line in context:

    protected static Map parseVariablesSection ( Element root )
	Map ret = new HashMap () ; 
	Map var = null ; 
	Iterator variables = root.getChildren ( "variable" ).iterator () ; 

where Element is a jdom.org.Element.

The conflict appears to be from the class com.sun.java.util.collections.Iterator
in collections.jar which comes with the jdom beta 7 distribution.
I tried removing the collections.jar from the jdom/lib directory, but then
I get the error "file com/sun/java/util/collections/List.class not found" from:

	Element root = new Element( "CBEConfiguration" ) ; 
	Document doc = new Document( root ) ;

where Element and Document are both from package jdom.org.
(I grep'd through all the jdom java files for "import.*sun" and did not 
get any matches.

If I change the classpath in ant to use an older version of jdom.jar,
everything is fine.

How do I resolve the conflict between the two versions of Iterator
when using beta 7 of jdom ?


Marc Laymon

More information about the jdom-interest mailing list