如何为使用JDK 11编译的Java程序将JRE与Launch4j捆绑在一起? [英] How to bundle a JRE with Launch4j for my java program compiled with JDK 11?

查看:127
本文介绍了如何为使用JDK 11编译的Java程序将JRE与Launch4j捆绑在一起?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Launch4j从.jar文件制作.exe文件.但是,当我将其提供给朋友时,它会不断收到该错误发生了JNI错误,请检查您的安装并重试".我认为JRE和JDK版本有问题.所以我看到了这个问题,但是它太旧了,现在来自OracleJDK11没有像以前那样单独的JRE.

I'm using Launch4j to make an .exe file from a .jar file. However, when I give it to a friend, it keeps getting that error "A JNI error has occurred, please check your installation and try again". I think I have a problem with JRE and JDK versions. So I saw this question, but it's too old and now Oracle from JDK11 does not have a separate JRE as before.

我想知道应该在launch4j程序中放入哪个最低JRE版本(这是强制性的),以及如何解决我朋友不断收到的错误?

I was wondering which minimum JRE version should I put in the launch4j program (it is mandatory) and how to solve that error that my friend keeps getting?

只是要弄清楚.我可以运行.exe文件,没有任何错误,但是当我将它交给我的朋友时,他们遇到了上面提到的错误.

Just to make clear. I can run the .exe file without any error, but when I hand it to my friend, they get that error mentioned above.

推荐答案

似乎代码是使用JDK 11编译的,但是您的朋友没有JRE/JDK 11,因此出现错误.自从您链接问题以来,答案并没有真正改变.(将JRE与EXE捆绑在一起,并使用捆绑的JRE)

It seems like the code is compiled with JDK 11, but your friend doesn't have JRE/JDK 11, hence the error. The answer hasn't really changed since the question you linked. (bundle the JRE alongside your EXE and use the bundled JRE)

对于将JRE 11捆绑在一起,您正确地说,不再有可以在任何地方下载的"Oracle JRE 11".您可以使用jlink创建自己的JRE发行版,也可以

As for getting JRE 11 to bundle, you're correct that there is no longer an "Oracle JRE 11" that you can download anywhere. You can either use jlink to create your own JRE distribution, or you can use the OpenJDK JRE 11 download.

第二个选项似乎容易得多,因此您只需从AdoptOpenJDK下载JRE 11,然后将其与EXE捆绑在一起即可.

It seems the second option is a lot easier, so you can just download the JRE 11 from AdoptOpenJDK, and bundle that alongside your EXE.

这篇关于如何为使用JDK 11编译的Java程序将JRE与Launch4j捆绑在一起?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆