在Windows操作系统上启动jarsk.exe,安装程序未安装jdk / jre [英] Launching jarsigner.exe on windows os which jdk/jre not installed by installer
问题描述
我已经将jre文件嵌入到我的应用程序设置中,我可以使用java.exe来执行一些特定于java的任务。
I've embedded jre files to my applications setup, i can use java.exe to perform some java specific tasks.
我想使用jarsigner.exe但是当我启动jarsigner时,它会检查一些注册表项,并且找不到(因为jre没有被jre设置),并且会出错。
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.
如何指定jarsigner的java.exe路径
How can i specify java.exe path to jarsigner
以便它应该使用我的java.exe而不是检查注册表。
so that it should use java.exe that i point instead of checking registry.
错误日志:
打开注册表项时出错'Software\JavaSoft \ Java运行时环境
Error opening registry key 'Software\JavaSoft\Java Runtime Environment
错误:找不到java.dll
Error: could not find java.dll
错误:找不到Java SE运行时环境
Error: could not find Java SE Runtime Environment
我想知道jarsigner是否有任何额外参数可以定义JAVA_HOME目录或其他任何定义java.exe的存在位置。
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.
推荐答案
没有特定的命令行参数,但是在调用 jarsigner
,您仍然可以将 java.home
属性设置为指向与您的应用程序捆绑在一起的所需JRE。
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.
例如,您可以使用以下任一方式调用 jarsigner
:
For instance, you could invoke the jarsigner
with either:
-
ProcessBuilder
并设置java.home
属性, - 或
Runtime.exec()
允许设置envp
环境变量, - 或批处理/ shell脚本,并在其中设置
JAVA_HOME
属性。
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.
这篇关于在Windows操作系统上启动jarsk.exe,安装程序未安装jdk / jre的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!