How to Fix the ‘Jarsigner: Only One Alias Can Be Specified’ Error

Learn the double meaning behind this Jarsigner alias error message and our handy tips to help you fix it
Editor’s Note: This article is one in a series of pieces we will publish over the next few weeks that aim to help resolve code signing-related errors for SignTool, Jarsigner, Electron, and Windows.
Jarsigner is notorious for blurting out ambiguous warnings, as is the case with the error “only one alias can be specified.” It’s one such message that may seem straightforward on the surface, but when you dig deeper, you’ll find that there’s more to it than you realize.
Let’s say you wanted to sign a .jar file without overwriting the original .jar. You type your signing command, incorporating the -signedjar option, followed by your chosen .jar file, and hit enter. But to your dismay, it didn’t work, resulting in displaying this error:
Jarsigner: only one alias can be specified

Image caption: The screenshot shows the “only one alias” alert.
What ‘Jarsigner: Only One Alias Can Be Specified’ Means
When the code signing process fails with this error, it’s usually due to typos in variables or because your Jarsigner file signing script includes more than one alias.
Boost User Trust in Your JAR Files — Save Up to 21% on a Java Code Signing Certificate
Prove your Java apps and JAR files are legitimate by signing them with a Java code signing certificate. You can get one starting at $211.46/year.
Possible Cause(s) of This Error
- Your code signing command includes more than one alias. This is to be expected from the name of the error, right? But what if it’s not the only cause?
- The code signing command has a small typo or similar issue. An example could be a mistyped filepath folder or a file name that includes spaces but isn’t wrapped in quotation marks. In the case of our example above, the “-” sign in front of the “signedjar” option is missing.
How to Fix This Jarsigner Issue
- Double-check for any typos. If there aren’t any, then rename your filepath folder or file and either remove the spaces or enclose it in quotation marks. For example, it could look like MyFiletoSign or “My_File_to_Sign.”
- Remove spaces from your filepath folder or file name. If there aren’t any typos or character issues, it could be that you’ve included spaces. (Jarsigner isn’t a fan of spaces in pathnames and such.) Rename your filepath folder or file and either remove the spaces or enclose it in quotation marks to see if it fixes the problem. For example, it could look like MyFiletoSign or “My_File_to_Sign.”
- Compare your script with the example below. Ensure that they match:
jarsigner -verbose -keystore NONE -storetype PKCS11 -tsa http://timestamp.digicert.com -providerClass sun.security.pkcs11.SunPKCS11 -providerArg ./eToken.cfg -signedjar C:\Users\file_path_to_your_jar_file\YourNewFileName.jar C:\Users\file_path_to_your_jar_file\YourFile.jar "Private Key Alias Name"
Platform(s)/Systems Affected
Java Jarsigner (Windows, Linux, macOS).