简体   繁体   中英

Java9, javac --add-exports java.xml.ws/javax.xml.ws=ALL-UNNAMED warning: [options] module name in --add-exports option not found: java.xml.ws

I have made a little test project where I use javax.xml.ws.Holder The package has been moved to module 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

This gives compiler warning

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

You can also see --add-exports java.management it works fine. I have tried to add-exports of all modules in java9 The modules below gets problems. I had a hobby theory that it was because the module was @Deprecated (seems not to hold)

# 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
warning: [options] module name in --add-exports option not found: java.xml.ws

You see this error because there is no java.xml.ws module. Correct module name is java.xml. So your command should be:

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

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