My project uses sun.security.tools.keytool to create a certificate in JDK 1.8, and this package can be found in rt.jar . According to an introduction to the dependency mechanism, system dependencies , I can add rt.jar as a dependency on my 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 am sure Maven found this jar file. However, when I import sun.security.tools.keytool.Main , it still generates an error. Moreover, the strangest thing is, if I rt.jar to a place and fill its path in pom.xml , it works! As soon as I get back to use the original rt.jar , it does not work!
Can someone tell me how this could happen?
java maven
old_bear
source share