运行java而不安装jre?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3371535/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Running java without installing jre?
提问by prosseek
As asked and answered here, python has a useful way of deployment without installers. Can Java do the same thing?
正如这里所问和回答的那样,python 有一种无需安装程序的有用部署方式。Java可以做同样的事情吗?
- 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)?
- 有没有办法在不安装jre的情况下运行Java的jar文件?
- 是否有类似 java2exe (win32)、java2bin (linux) 或 java2app (mac) 之类的工具?
采纳答案by haffax
You can use Launch4jfor 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.
您可以为此使用Launch4j。有据可查且易于使用。虽然生成的程序仍需要 JRE 才能运行,但您不必在目标系统上安装 JRE。您可以将它与您的应用程序一起复制,然后告诉 Launch4j 找到它,或者将它与其他所有内容一起打包。
回答by Noel M
回答by mhshams
you can embbed the JRE inside your application and create a setup or installation for your application.
您可以将 JRE 嵌入您的应用程序并为您的应用程序创建设置或安装。
回答by Anindya Chatterjee
You can have a look at
你可以看看
http://www.bearcave.com/software/java/comp_java.html
http://www.bearcave.com/software/java/comp_java.html
You might get it what you want.
你可能会得到你想要的。
回答by Tassos Bassoukos
You might want to check out how Eclipse does it - it has a native .exe that can use a local (to the installation) JRE.
您可能想看看 Eclipse 是如何做到的 - 它有一个可以使用本地(安装)JRE 的本机 .exe。
回答by barjak
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).
要创建本机可执行文件,您可以使用Excelsion Jet,它将 Java 编译为本机代码。我们将它用于工作中的一个项目,我们不得不对原始源代码(针对 Sun 的 JDK)进行零修改。
回答by eniel.rod
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.
您可以使用 NetBeans 和一些工具来完成。结果是一个独立的安装程序,它打包了您需要的一切,因此您的软件可以在不安装 JRE 的情况下运行。它也是完全可移植的,因为它将您的软件安装在 AppData 上,也就是说,它不需要安装权限。也许您甚至可以配置安装路径,或者您可以将其安装在您自己的 PC 上,找到该文件夹并将其复制以通过这种方式分发您的软件。