简体   繁体   中英

package com.sun.xml.internal.messaging.saaj.soap.dynamic does not exist

I am trying to compile a java file, which uses package com.sun.xml.internal.messaging.saaj.soap.dynamic , using ANT-1.9.3 but I'm receiving error

package com.sun.xml.internal.messaging.saaj.soap.dynamic does not exist

I tried compiling both JDK7 and JDK 8 and getting the same error.

I can see the package exist inside rt.jar of both JDK. I have set JAVA_HOME also properly.

Can someone help me to resolve this issue?

Unfortunately for you, this behaviour is probably intentional and your usage is deliberately unsupported. If your code used to compile under Java6 and now doesn't under Java7 or Java8 then you've basically fallen foul of

From one release to another, these classes may be removed, or they may be moved from one package to another

http://www.oracle.com/technetwork/java/faq-sun-packages-142232.html

See also http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6778491 for a technical description of a possible cause of not being able to compile a class which references a 'com.sun.*' class but which throws the same compiler error you're seeing despite the fact that the referenced class exists in rt.jar. Also for the kind of response which Oracle give to bug reports relating to it;)

Unfortunately, using undocumented, unsupported APIs often has this kind of 'bite you in the posterior' kind of effect.

Please add the line, < compilerarg line="-XDignore.symbol.file" compiler="modern"/ > for < javac > tag in your build.xml. This should solve your problem. It solved for me.

For reference you can view the forum link http://www.icesoft.org/JForum/posts/list/19871.page#sthash.srrN9Ijk.dpbs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM