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.
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 thejava.home
property,- or a variant of
Runtime.exec()
allowing to set theenvp
environment variables, - or a batch/shell script and set the
JAVA_HOME
property in it.
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.
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.
来源:https://stackoverflow.com/questions/10991856/launching-jarsigner-exe-on-windows-os-which-jdk-jre-not-installed-by-installer