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.

mimicocotopus
  • 5,280
  • 4
  • 22
  • 24

11 Answers11

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.

Matt Wolfe
  • 8,924
  • 8
  • 60
  • 77
  • 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. – mimicocotopus Aug 27 '12 at 03:20
  • 3
    Yes, jarsigner is just a front end to use the Java crypto classes which perform the signing. – mparaz Aug 27 '12 at 03: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 03 '14 at 09:52
  • Had it in: C:/Program Files/AdoptOpenJDK/jdk-8.0.265.01-hotspot/bin/jarsigner.exe – AturSams Aug 30 '20 at 17:21
  • In my case C:\Program Files\Java\jdk-15.0.1\bin – Mark Kahn Nov 07 '20 at 14:47
  • In Amazon Linux (maybe CentOS too?), the OpenJDK packages just provide a dead link for jarsigner - but it can be found in the -devel version of the package, e.g: java-1.8.0-openjdk-devel – Idris Apr 09 '21 at 15:49
21

%JAVA_HOME%\bin\jarsigner

You can find jarsigner there. Install jdk first.

FrancescoAzzola
  • 2,666
  • 2
  • 15
  • 22
  • 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 '13 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 08 '14 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`. – Alexei - check Codidact Oct 29 '17 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.

starmandeluxe
  • 2,443
  • 3
  • 27
  • 44
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

user3760100
  • 679
  • 1
  • 9
  • 20
4

In my case I try this:

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

I use openjdk

Dita Aji Pratama
  • 710
  • 1
  • 12
  • 28
3

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

Asaf Pinhassi
  • 15,177
  • 12
  • 106
  • 130
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

Brian Nyagol
  • 69
  • 1
  • 10
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/

Magor Menessy
  • 381
  • 4
  • 13
  • 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 '16 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

Jiya
  • 745
  • 8
  • 19
0

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

gilcierweb
  • 2,598
  • 1
  • 16
  • 15
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.

fanbyprinciple
  • 554
  • 7
  • 14