简体   繁体   English

使用Install4J将javax复制到JRE

[英]Copy javax to JRE using Install4J

I am using install4J to distribute my application . 我正在使用install4J分发我的应用程序。 However i am using serial port in my program therefore i will need the below file to be copied to the target JRE folder 但是我在程序中使用串行端口,因此我需要将以下文件复制到目标JRE文件夹中

%JAVA_HOME%/lib/ext/comm.jar
%JAVA_HOME%/bin/win32com.dll
%JAVA_HOME%/lib/javax.comm.properties

Is there any way i can do it by getting the Java Home Path via Install4J ? 有什么办法可以通过Install4J获取Java Home Path吗?

Thanks 谢谢

Since JAVA_HOME is not a Windows variable, it will be tricky to get it, and Install4J does not have a JAVA_HOME variable to my knowledge. 由于JAVA_HOME不是Windows变量,因此获取它会很棘手,据我所知Install4J没有JAVA_HOME变量。 While JAVA_HOME could be set on some computers, it is not safe to assume it is set on all computers. 尽管可以在某些计算机上设置JAVA_HOME,但假定在所有计算机上都设置了JAVA_HOME是不安全的。

What I would do, personally, is not touch the user's JRE. 就我个人而言,我要做的是不接触用户的JRE。 Bundle your own custom JRE with those files included into your install file generated with Install4J. 将您自己的自定义JRE与包含在由Install4J生成的安装文件中的那些文件捆绑在一起。 That way, your program will always work with its own custom JRE that is independent of the system's JRE. 这样,您的程序将始终使用独立于系统JRE的自定义JRE。

Copy the files to 将文件复制到

${installer:sys.javaHome}

This is the JRE that the installer and subsequently your launchers run with. 这是安装程序和随后的启动程序一起运行的JRE。 If you bundle a JRE, the value of this variables changes after the "Install files" action runs. 如果捆绑了JRE,则在“安装文件”操作运行后,此变量的值将更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM