Running java without installing jre?

◇◆丶佛笑我妖孽 提交于 2021-02-11 12:31:48

问题


As asked and answered here, python has a useful way of deployment without installers. Can Java do the same thing?

  • Is there any way to run Java's jar file without installing jre?
  • Is there a tool something like java2exe (win32), java2bin (linux) or java2app (mac)?

回答1:


You can use Launch4j for this. Well documented and easy to use. While the resulting program still needs a JRE to run, you don't have to install the JRE on the target system. You can just copy it with your application and tell Launch4j were to find it or just wrap it up with everything else.




回答2:


For creating native executables, you can use Excelsion Jet, which compiles Java to native code. We used it for a project at work, and we had to perform zero modification to the original source code (which targetted Sun's JDK).




回答3:


you can embbed the JRE inside your application and create a setup or installation for your application.




回答4:


You can have a look at

http://www.bearcave.com/software/java/comp_java.html

You might get it what you want.




回答5:


You might want to check out how Eclipse does it - it has a native .exe that can use a local (to the installation) JRE.




回答6:


You can do it with NetBeans and a couple of tools. The result is a standalone installer that packages everything you need, so your software can run without installing JRE. It is also completely portable, because it install your software on AppData, that is, it does not need privileges to be installed. Maybe you can even configure the installation path, or you can install it on your own PC, locate the folder and copy it to distribute your software in that way.

Check the Answer I made on different post




回答7:


You can use jlink to create your own customized jre which would contain only those dependencies which are needed for execution. This deployment method is really efficient. please follow **this**link for one such example.




回答8:


You might be able to get some luck with GCJ - haven't tried it myself.



来源:https://stackoverflow.com/questions/56930558/how-to-run-jar-without-jre-installed-manually

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!