问题
I'm trying to sign a JAR file. I generated a new store using the
"keytool -genkey -alias myStore -keystore mainstore"
And the store got generated with the actual name "mainstore" under my Windows user directory.
I then try to self sign the JAR file using
"jarsigner myApp.jar myStore".
But I'm getting error:
jarsigner error: java.lang.RuntimeException: keystore load: C:\Users\myusername \.keystore (The system cannot find the file specified)
I looked and the .keystore file is not there. I think it got deleted by accident. Is there a way to generate a new .keystore file?
Thanks in advance.
回答1:
As the manual page for jarsigner states:
jarsigner
has a-keystore
option for specifying the name and location of the keystore to be used. The keystore is by default stored in a file named.keystore
in the user's home directory, as determined by theuser.home
system property.
Which means that in Windows, C:\Users\myusername\.keystore
is the default keystore file.
So what you probably need to do is tell jarsigner
where your keystore is located:
jarsigner -keystore mainstore myApp.jar myStore
回答2:
Your file might not be deleted, I was having the same problem and updating to the latest jdk solved my problem.
来源:https://stackoverflow.com/questions/9006659/keystore-deleted-by-accident