3

I am trying to verify signature of apk uploaded on my site. I am trying to execute

String command= "cmd /c jarsigner -verify -verbose -certs " +Filelocation;
Process proc = Runtime.getRuntime().exec(command);
BufferedReader reader=new BufferedReader(new InputStreamReader(proc.getInputStream()));
BufferedReader reader1=new BufferedReader(new InputStreamReader(proc.getErrorStream()));
String line=reader.readLine();  
String line1=reader1.readLine();

line output is null and line1 output is"Jarsigner is not recognized internal external command".

I have checked java_home,java.home,java.class.path. java_home is holding jdk path java.home is holding jre path java.class.path holds jboss server>deploy folder.

I am running this part of code on JBOSS Server.

Trinimon
  • 13,839
  • 9
  • 44
  • 60
user2381331
  • 31
  • 1
  • 1
  • 4
  • Duplicate question, answer here http://stackoverflow.com/questions/33132310/jarsigner-is-not-recognized-internal-or-external-command – Mohamad Al Asmar Apr 01 '17 at 10:44

3 Answers3

8

Make sure Java JDK is set on the PATH. In my case put "D:\Java\jdk1.6.0_34\bin" into System Variable PATH.

stuckedunderflow
  • 3,551
  • 8
  • 46
  • 63
0

Make sure the release key and the apk are in the same directory.

0

1 Make sure below Environment Variables are set:

Variable name: JAVA_HOME Varaible value: C:\Program Files\Java\jre7 (example only; update path based on your Java library location)

Variable name: Path Varaible value: %JAVA_HOME%\bin;

2 Make sure that jarsigner.exe file exists in your JAVA library ie.

C:\Program Files\Java\jre7\bin\jarsigner.exe
Community
  • 1
  • 1
marika.daboja
  • 881
  • 13
  • 27