Dear Mojo Keytool Api Developers,
The aim is to get information from keystore.jks file by using the latest
jar distribution.
I was able to import base jar files keytool-api-1.3.jar /
keytool-api-1.7-1.3.jar as well as dependency jar file into the java build
path for eclipse.
classworlds-1.1.jar
commons-lang-2.6.jar
hamcrest-core-1.3.jar
plexus-container-default-1.0-alpha-10.jar
plexus-utils-3.0.1.jar
However, when trying to create a simple class I am getting an error on
keytool class. Eclipse tells me "Cannot make a static reference to the
non-static field keyTool" This is quite logic since there is no instance of
keytool object defined.
Also noticed, that KeyTool.class is an Interface and cannot be
instantiated. So, I am stuck on trying to run execute method and cannot
continue on my research.
It would be great if you can provide me some sort of support or guidance.
File file = new File("C:\\Users\\pepe\\keystore.jks");
KeyToolPrintCertificateRequest request = new
KeyToolPrintCertificateRequest();
request.setVerbose( true );
request.setFile(file);
KeyToolResult result = *keyTool*.execute( request );
// control the execution result
result.getExitCode();
// get exception
result.getExecutionException();
Juan
**