Generated CXF client would not compile with Java 1.5 on Eclipse
Question
Today I generated a webservice client with CXF 2.6.1 (latest version), using the tool wsdl2java provided. I want to compile the generated classes with Java 5 on Eclipse but it fails because of the following imports:
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
The CXF FAQ states that I can use it with Java 5. So I don't understand why it wouldn't compile in Eclipse.
I asked for a build.xml
to be generated. When I run ant
with that script, it works. The build.xml
be found by downloading CXF 2.6.1 or inline as a template (easy to understand; the ant-target to use is build
). From it, I deduced I needed to grab the following libraries, which I did and put in my eclipse project.
- cxf-manifest.jar
- geronimo-jaxws_2.2_spec-1.1.jar
- jaxb-api-2.2.6.jar
So how can I get it compiling in Eclipse? What libraries, if any, am I missing?
Notes:
- I have to use JDK5 to both compile and run.
- My version of Eclipse is 3.7.
- I have Java 6 installed, but my JAVA_HOME points well to my JDK5 instance. When I type
set
in a Windows command prompt, there is no reference to my Java 6 installation folder.
Solution
I don't need to copy the CXF libraries, just to link them inside my project. That works, since cxf-manifest.jar is a jar file with nothing in it except for a classpath which in turn loads all the libraries of CXF.