• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

keytool error java.io.FileNotFoundException: (Access is denied)

by admin

keytool manages and manipulates a keystore, a repository for public and private keys and public key certificates. keytool defines various commands for generating keys, importing data into the keystore, and exporting and displaying keystore data. Keys and certificates are stored in a keystore using a case-insensitive name or alias. keytool uses this alias to refer to a key or certificate.

The Problem

You launched the Command Prompt to create a keystore as below, and in the end the error occurred.

$ keytool -genkey -alias mykeystore -keyalg RSA -keystore KeyStore.jks -keysize 2048

Enter keystore password:
Re-enter new password:
What is your first and last name?
      [Unknown]: joysu
What is the name of your organizational unit?
      [Unknown]: ps
What is the name of your organization?
      [Unknown]: ddw
What is the name of your City or Locality?
      [Unknown]: ocoee
What is the name of your state or province?
      [Unknown]: fl
What is the two-letter country code for this unit?
      [Unknown]: us
Is CN=joysu, OU=ps, O=ddw, L=ocoee, ST=fl, C=us correct?
      [No]: yes

Enter key password for ,jkskeystore.
                (RETURN if same as keystore password):

keytool error: java.io.FileNotFoundException: keystore.jks (Access is denied)

The Solution

Change the directory and file access permission to allow you to access the file.

If change access permission does not solve the problem, launch the Command Prompt as an administrator. Right click on Command Prompt and select “Run as administer”.

Final Thoughts

The JDK provides a command-line utility named keytool for manipulation of the keystore key database. This tool is run from the command line and accepts a number of parameters that allow it to be used to create new certificates, to import certificates, to delete certificates, or to generate certificate-signing requests (CSRs) for Certificate Authorities. In this post we have seen how to resolve the error “keytool error java.io.FileNotFoundException: (Access is denied)”.

Filed Under: Java

Some more articles you might also be interested in …

  1. Java Loop Control
  2. Java Jump Statements – break, continue, labeled statement
  3. Basics of Java Operators
  4. Scope of Variables in Java
  5. Java String Classes – StringBuilder and StringTokenizer
  6. Introduction to Java Packages
  7. Java – Inner classes
  8. Java Operators
  9. flow: A static type checker for JavaScript
  10. Assertions in Java

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright