Java9,javac --add-exports java.xml.ws/javax.xml.ws=ALL-UNNAMED警告:找不到--add-exports选项中的[options]模块名称:java.xml.ws

时间:2017-10-23 05:56:02

标签: java

我做了一个小测试项目,我使用javax.xml.ws.Holder 该包已移至模块java.xml.ws

import javax.xml.ws.Holder;
    javac \
     --add-exports java.xml.ws/javax.xml.ws=ALL-UNNAMED \
     --add-exports java.management/sun.management=ALL-UNNAMED \
     -sourcepath src/main/java @target/sources.txt -d target/classes

这会产生编译器警告

warning: [options] module name in --add-exports option not found: java.xml.ws

您还可以看到--add-exports java.management它可以正常工作。 我试图在java9中添加所有模块的导出 以下模块会出现问题。 我有一个爱好理论,因为模块是@Deprecated(似乎没有举行)

# module name in --add-exports option not found: java.xml.ws                    @Deprecated
# module name in --add-exports option not found: java.activation                @Deprecated
# module name in --add-exports option not found: java.corba                     @Deprecated
# module name in --add-exports option not found: java.jnlp                      NOT deprecated
# module name in --add-exports option not found: java.se.ee                     NOT deprecated
# module name in --add-exports option not found: java.smartcardio               NOT deprecated
# module name in --add-exports option not found: java.transaction               @Deprecated
# module name in --add-exports option not found: java.xml.bind                  @Deprecated
# module name in --add-exports option not found: java.xml.ws.annotation         @Deprecated
# module name in --add-exports option not found: javafx.deploy                  NOT deprecated
# module name in --add-exports option not found: jdk.charsets                   NOT deprecated
# module name in --add-exports option not found: jdk.crypto.cryptoki            NOT deprecated
# module name in --add-exports option not found: jdk.crypto.ec                  NOT deprecated
# module name in --add-exports option not found: jdk.deploy                     NOT deprecated
# module name in --add-exports option not found: jdk.deploy.controlpanel
# module name in --add-exports option not found: jdk.editpad
# module name in --add-exports option not found: jdk.hotspot.agent
# module name in --add-exports option not found: jdk.incubator.httpclient
# module name in --add-exports option not found: jdk.internal.vm.ci
# module name in --add-exports option not found: jdk.javaws
# module name in --add-exports option not found: jdk.jcmd
# module name in --add-exports option not found: jdk.jstatd
# module name in --add-exports option not found: jdk.localedata
# module name in --add-exports option not found: jdk.naming.dns
# module name in --add-exports option not found: jdk.naming.rmi
# module name in --add-exports option not found: jdk.pack
# module name in --add-exports option not found: jdk.plugin
# module name in --add-exports option not found: jdk.plugin.server
# module name in --add-exports option not found: jdk.policytool
# module name in --add-exports option not found: jdk.rmic
# module name in --add-exports option not found: jdk.scripting.nashorn.shell
# module name in --add-exports option not found: jdk.snmp
# module name in --add-exports option not found: jdk.xml.bind
# module name in --add-exports option not found: jdk.xml.ws
# module name in --add-exports option not found: jdk.zipfs

1 个答案:

答案 0 :(得分:0)

warning: [options] module name in --add-exports option not found: java.xml.ws

您看到此错误,因为没有java.xml.ws模块。正确的模块名称是java.xml。所以您的命令应该是:

import javax.xml.ws.Holder;
javac \
 --add-exports java.xml/javax.xml.ws=ALL-UNNAMED \
 --add-exports java.management/sun.management=ALL-UNNAMED \
 -sourcepath src/main/java @target/sources.txt -d target/classes