[java] Where is jarsigner?

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.

This question is related to java android

The answer is


%JAVA_HOME%\bin\jarsigner

You can find jarsigner there. Install jdk first.


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/


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


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


In my case I try this:

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

I use openjdk


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.


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


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


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