.keystore deleted by accident

2019-08-07 12:04发布

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.

2条回答
欢心
2楼-- · 2019-08-07 12:42

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 the user.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
查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-08-07 12:52

Your file might not be deleted, I was having the same problem and updating to the latest jdk solved my problem.

查看更多
登录 后发表回答