Shell script to facilitate bulk-importing certificates into a JDK's cacerts keystore. Designed for Windows environments using Git Bash, WSL, or Cygwin (calls keytool.exe with Windows-style paths).
When run, the script imports every .crt/.cer file from a configured directory into the cacerts of a configured JDK, using each filename as the alias and the default changeit password (configurable).
Edit two variables at the top of the script:
pathJava="C:\Program Files\Java\jdk-11.0.9"
pathCertificate="C:\certificates"pathJava— path to the JDK installation.pathCertificate— directory containing the certificate files to import.
./quick-certificates-jdk.shThe script handles both JDK 8 (legacy -keystore cacerts flag) and JDK 9+ (modern -cacerts shortcut) automatically.
- Useful for development environments where new team members need to import multiple internal certificates into their JDK cacerts before accessing internal infrastructure.
- Windows-specific (uses
keytool.exeand Windows-style paths).
MIT.