executing jarsigner command generates error: "Jarsigner is not recognized internal or external command"

user2381331 picture user2381331 · May 14, 2013 · Viewed 9.6k times · Source

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.

Answer

stuckedoverflow picture stuckedoverflow · Apr 29, 2014

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