71

I have the Android SDK installed on both a Linux machine using open SuSE 12.1. I've used both machines to successfully build Android apps many times and sign them both with a debug key for testing and a release key from my own keystore, so it should be somewhere on each machine.

Using the command

jarsigner

Returns a command not found error on both machines, however. I've looked in the Android SDK folder, JDK folder on Windows, and /usr/lib64/jvm/ but it's not anywhere I've looked.

I assume it must be under a different name. I've also run:

find -name jarsigner

over the whole system on the Linux box with no success.

1
  • 1
    Mine was located at /usr/bin/jarsigner, even though find didn't find it...
    – Nearoo
    Dec 4, 2016 at 23:18

11 Answers 11

106

It's in the bin folder of your java JDK install (Java SE). If you only have the JRE installed you probably don't have it.

6
  • This turned out to be the problem, at least on the Linux box. There must be something else which the SDK uses to the signing through Eclipse however, because I've already signed many builds successfully through the SDK on the same machine. Aug 27, 2012 at 3:20
  • 3
    Yes, jarsigner is just a front end to use the Java crypto classes which perform the signing.
    – mparaz
    Aug 27, 2012 at 3:34
  • 1
    "If you only have the JRE installed" --this part was critical for me. Trying to create a JNLP for web deployment. "keytool" exists in the JRE. This answer helped me to look for "jarsigner" in the JDK.
    – Jonathan
    Jul 3, 2014 at 9:52
  • Had it in: C:/Program Files/AdoptOpenJDK/jdk-8.0.265.01-hotspot/bin/jarsigner.exe
    – AturSams
    Aug 30, 2020 at 17:21
  • In my case C:\Program Files\Java\jdk-15.0.1\bin
    – Mark Kahn
    Nov 7, 2020 at 14:47
21

%JAVA_HOME%\bin\jarsigner

You can find jarsigner there. Install jdk first.

3
  • 2
    I had JRE installed before JDK. So, the path I was looking for was: C:\Program Files\Java\jdk1.6.0_45\bin\jarsigner
    – Jason
    Oct 18, 2013 at 18:17
  • %JAVA_HOME%\bin did not work as a shortcut in my PATH. I had to put the full path into the PATH setting. This isn't the first time this has happened with Java commands. (Windows 7)
    – quilkin
    Aug 8, 2014 at 14:33
  • That's the best way for those not having any installation issues. However, I would use quotes to support path with blanks: "%JAVA_HOME%\bin\jarsigner" as most Windows installations are within Program Files. Oct 29, 2017 at 20:05
11

For posterity's sake, if you are trying to actually use jarsigner to sign a jar file (such as that of an applet) with a keystore, you'll need to reference jarsigner while running the command from the folder that your keystore is in:

cd "C:\Program Files\Java\jre(version#)\bin"

then

"C:\Program Files\Java\jdk(version#)\bin\jarsigner.exe" -keystore mykeystore (PATH TO YOUR .JAR)\MyJarFile.jar alias

The above might be obvious, but it took me a few tries because I was trying to call jarsigner while inside the JDK folder, which had no knowledge of where my keystore was (in the jre directory!), so I hope this will help those who would like to see a usable syntax for that situation.

9

If you are on Mac or Linux, just go to the terminal and type in:

whereis jarsigner

It will give you the location of the jarsigner

4

In my case I try this:

sudo apt install openjdk-11-jdk-headless
sudo apt install openjdk-8-jdk-headless

I use openjdk

0
3

If you can't find it, download and install Java JDK from here

1

This error comes when you only have JRE installed instead of JDK in your JAVA_HOME variable. Unfortunately, you cannot have both of them installed in the same variable so you just need to overwrite the variable with new JDK installation path.

The process should be the same as the way you had JRE installed

1

For me the solution was in setting the global variable path to the JDK. See here: https://appopus.wordpress.com/2012/07/11/how-to-install-jdk-java-development-kit-and-jarsigner-on-windows/

1
  • 2
    Would be a good idea to add the relevant bits of the link here, in the event that the link dies or otherwise becomes unavailable.
    – CubeJockey
    May 16, 2016 at 14:46
1

This will install jdk for you and check for the jarsigner inside it

sudo apt install -y default-jdk

to find jarsigner you can use whereis jarsigner

0

Find in /usr/lib/jvm/java-8-oracle/bin/jarsigner -verbose -sigalg SHA1withRSA

0

You need to install openjdk-11

apt-get install openjdk-11-jdk

You will find that post installation of openjdk jarsigner is available in the terminal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.