Eclipse cannot find latest Java 1.6 methods for XMLOutputFactory

I am trying to use the newFactory() method for XMLOutputFactory , which was added in Java 6. But Eclipse continues to mark newFactory() as undefined for the XMLOutputFactory type. JRE7 is the only runtime installed in the path to building new Java projects. The project itself has only JRE7 (JRE System Library) and Ivy. The error I am getting is

 The method newFactory() is undefined for the type XMLOutputFactory 

Any ideas how to get Eclipse to accept newFactory ? return XMLOutputFactory.newFactory() much just using return XMLOutputFactory.newFactory() as the only place the function is called.

+6
source share
3 answers

I had the same problem and fixed it by removing StAX from my class path because the version of XMLOutputFactory that ships with Java 7 provides the newFactory method, but the version of XMLOutputFactory that ships with StAX does not have this.

+1
source

I had the same problem and resolved it with: XMLInputFactory factory = XMLInputFactory.newInstance(); you can visit:

click here for a detailed description

+1
source

I create and import an Apache Phoenix project. the XMLResultHandler class threw the same error, "The newFactory () method is undefined for the XMLOutputFactory type." I solved the problem by reordering the Java System Library and stax-api-1.0-2.jar.

After the correction of the eclipse project Snapshot of the library order

0
source

Source: https://habr.com/ru/post/951074/


All Articles