2

I've embedded jre files to my applications setup, i can use java.exe to perform some java specific tasks.

And i want to use jarsigner.exe but when i launch jarsigner, it checks some registry keys, and could not found (because jre is not insatalled by jre setup) them and gives error.

How can i specify java.exe path to jarsigner

so that it should use java.exe that i point instead of checking registry.

error log:

Error opening registry key 'Software\JavaSoft\Java Runtime Environment

Error: could not find java.dll

Error: could not find Java SE Runtime Environment

I wonder are there any extra parameters for jarsigner may be that defines JAVA_HOME dir, or anything else that defines where java.exe is exists.

Community
  • 1
  • 1
tutalia
  • 285
  • 3
  • 16
  • "I've embedded jre files to my applications setup". Clearly you need to embed some *JDK* files into your application setup, and clearly you should use the JDK's own installer to do so. – user207421 Jun 12 '12 at 10:58
  • 2
    @EJP: yes, i actually added some jdk files (jli.dll, msvcr71.dll, and tools.jar with jarsiger.exe) to application setup, these work fine on a system that jre installed but jdk not installed. – tutalia Jun 12 '12 at 12:18

3 Answers3

2

There are no specific command-line parameters, however while invoking jarsigner, you can still set the java.home property to point to your desired JRE bundled with your application.

For instance, you could invoke the jarsigner with either:

  • ProcessBuilder and set the java.home property,
  • or a variant of Runtime.exec() allowing to set the envp environment variables,
  • or a batch/shell script and set the JAVA_HOME property in it.
haylem
  • 22,460
  • 3
  • 67
  • 96
1

To make jarsigner work with JRE instead of JDK. Need to bundle these files in JRE from JDK

From \bin\jarsigner.exe to \bin\jarsigner.exe From \bin\msvcr100.dll to \bin\msvcr100.dll From \bin\jli.dll to \bin\jli.dll From \lib\tool.jar to \lib\tool.jar I tested with this and found it working for me.

aviundefined
  • 802
  • 2
  • 10
  • 25
  • I just needed \bin\jarsigner.exe and \lib\tool.jar. Make sure these are from the same version of the SDK as the installed JRE, or you'll get a version error. – Dunc Jun 24 '14 at 22:30
0

Stolen from Java Error opening registry key

Remove if any.

on 32 bit machine

java.exe, javaw.exe and javaws.exe from your Windows\System32 folder

on 64 bit machine

remove from Windows\SysWOW64.

Community
  • 1
  • 1
Vipul
  • 27,808
  • 7
  • 60
  • 75
  • i could not do that jre/jdk would be installed or not. i want from my jarsigner.exe to use jre i provide. – tutalia Jun 12 '12 at 07:21