java - Maven can't compile using rt.jar -


my project uses sun.security.tools.keytool generate certificate under jdk 1.8 , package can found in rt.jar. according introduction dependency mechanism, system dependencies, can add rt.jar dependency project:

<dependency>   <groupid>sun.jdk</groupid>   <artifactid>rt.jar</artifactid>   <version>1.8</version>   <scope>system</scope>   <systempath>${java.home}/lib/rt.jar</systempath> </dependency> 

i'm pretty sure maven found jar file. when import sun.security.tools.keytool.main, still generates error. moreover, strange thing if copy rt.jar someplace , fill path in pom.xml, works! switch use original rt.jar, fails!

can tell me how happen?

i created maven project , added <dependency> of question pom.

first got:

[error] compilation error :  [info] ------------------------------------------------------------- [error] .../so-31353565/src/main/java/igb/so/so31353565.java:[6,34]     package sun.security.tools.keytool not exist [error] .../so-31353565/src/main/java/igb/so/so31353565.java:[12,50]     cannot find symbol   symbol:   variable main   location: class igb.so.so31353565 

then, according cannot find symbol (certandkeygen) jdk8, added:

<build>   <pluginmanagement>     <plugins>       <plugin>         <groupid>org.apache.maven.plugins</groupid>         <artifactid>maven-compiler-plugin</artifactid>         <version>3.2</version>         <configuration>           <fork>true</fork>           <compilerargument>-xdignore.symbol.file</compilerargument>         </configuration>       </plugin>     </plugins>   </pluginmanagement> </build> 

to pom , compilation suceeded.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -