Reputation: 23
In my project I have standard java system library with rt.jar that have class.
package javax.xml;
public final class XMLConstants {
private XMLConstants() {
}
public static final String NULL_NS_URI = "";
public static final String DEFAULT_NS_PREFIX = "";
...
}
And also included is stax-api-1.0.jar with class
package javax.xml;
public class XMLConstants {
public static final String DEFAULT_NS_PREFIX = "";
public static final String XML_NS_PREFIX = "xml";
public static final String XML_NS_URI = "http://www.w3.org/XML/1998/namespace";
public static final String XMLNS_ATTRIBUTE = "xmlns";
public static final String XMLNS_ATTRIBUTE_NS_URI = "http://www.w3.org/2000/xmlns/";
}
And in third class I need to get NULL_NS_URI that looks like this
import javax.xml.XMLConstants;
public myClass(){
doSomethin() {
...
XMLConstants.NULL_NS_URI
...
}
}
It gives error
NULL_NS_URI cannot be resolved or is not a field
And when I ctrl + click on XMLConstants in myClass eclipse takes me to class stax-api.jar. When I do same thing on colleague machine eclipse take him to rt.jar with no error because NULL_NS_URI is defined in that class.
Upvotes: 2
Views: 13018
Reputation: 855
Check your build class path order. If the rt.jar
resides above the stax-api-1.0.jar
, the problem should get resolved. Because, while compilation, the compiler looks up the jars in the build class path order.
Upvotes: 19