AnnotationProcessorFactory class not found in java 8

非 Y 不嫁゛ 提交于 2019-12-12 11:56:30

问题


I had a project which is build on java 1.6 and

Now i upgraded the java verion to 1.8 and build the project

Here i have used gradle for building the project Here is the gradle code

task wsgen(dependsOn: compileJava)  {

    doLast{
        ant {
            taskdef(name:'wsgen',
                classname:'com.sun.tools.ws.ant.WsGen',
                classpath:configurations.jaxws.asPath)
            wsgen(keep:true,
                destdir: "${buildDir}",
                resourcedestdir:"${sourceSets.main.output.resourcesDir}",
                sourcedestdir:'src/main/java',
                genwsdl:'true',
                classpath:"${configurations.compile.asPath}:${sourceSets.main.output.classesDir}",
                sei:'<sei implementation class>')
        }
    }
}

and the error , am getting is

java.lang.NoClassDefFoundError: com/sun/mirror/apt/AnnotationProcessorFactory

Can any one tell me, where the issue is located and raising from?

Thank you!!!


回答1:


Thanks go out to @McDowell for the useful comment with links. So the APT tool is gone. Use a version 7 JDK for building your project. Just install it alongside your java 8 JDK and create a script specifically for building your project that requires the APT tool.

I had the same problem and went around it by running maven using the 1.7 version of JDK. So I created a script (.cmd on windows platform) that, for me, looks like this:

set JAVA_HOME="c:\Java\ibm-jdk-1.7.0"
set PATH=%JAVA_HOME%\bin;%PATH%
mvn clean install eclipse:eclipse

This will successfully build using an IBM version of the java 7 jdk, which i happen to have in my java folder. I hate the fact that I can't build my projects with the version 1.8 jdk but at least i can use java 8 features on other projects.



来源:https://stackoverflow.com/questions/24242856/annotationprocessorfactory-class-not-found-in-java-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!