Solution: open the keytool.exe in Explorer so it’s in the directory. Right click on it. Choose compatiblitiy mode tab and select “run as administrator” then it will pop up a window asking for permission when you run it and write the file correctly.

 

Problem:

C:\Program Files\Java\jdk1.6.0_11\bin>keytool -genkey -v -keystore Amanda.keysto
re -alias Aman -keyalg RSA -validity 10000
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: Amanda
What is the name of your organizational unit?
[Unknown]: Twist
What is the name of your organization?
[Unknown]: Twist Maker
What is the name of your City or Locality?
[Unknown]: Bangalore
What is the name of your State or Province?
[Unknown]: Karnataka
What is the two-letter country code for this unit?
[Unknown]: IN
Is CN=Amanda, OU=Twist, O=Twist Maker, L=Bangalore, ST=Karnataka, C=IN correct?
[no]: Y

Generating 1,024 bit RSA key pair and self-signed certificate (SHA1withRSA) with
a validity of 10,000 days
for: CN=Amanda, OU=Twist, O=Twist Maker, L=Bangalore, ST=Karnataka, C=IN

Enter key password for <Aman>
(RETURN if same as keystore password):
[Storing Amanda.keystore]
keytool error: java.io.FileNotFoundException: Amanda.keystore (Access is denied)

java.io.FileNotFoundException: Amanda.keystore (Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.j ava:179)
at java.io.FileOutputStream.<init>(FileOutputStream.j ava:70)
at sun.security.tools.KeyTool.doCommands(KeyTool.java :902)
at sun.security.tools.KeyTool.run(KeyTool.java:172)
at sun.security.tools.KeyTool.main(KeyTool.java:166)

Alex Smirnov

Senior Java Developer. JAVA, PHP, Cold Fusion, SQL, Air, Flash.

More Posts