简体   繁体   English

如何在不需要安装 jdk 或 jre 的情况下运行 java 程序

[英]How to run a java program without requiring jdk or jre to be installed

I want to run my java program in another PC which do not have java installed and I want to do so either.我想在另一台没有安装 java 的 PC 上运行我的 java 程序,我也想这样做。 I want a method by which I have to click on an icon and my program runs which will not need java installed on the system.我想要一种方法,通过该方法我必须单击一个图标并且我的程序运行而无需在系统上安装 java。 Creating a .jar file or .exe file by Launch4J did not help as they need to have java installed on the system.通过 Launch4J 创建 .jar 文件或 .exe 文件没有帮助,因为他们需要在系统上安装 java。

By the way, my program is built using javafx, it do not need console input or output.顺便说一句,我的程序是使用 javafx 构建的,它不需要控制台输入或输出。 All the work is done in a window created using javafx.所有工作都在使用 javafx 创建的窗口中完成。

You can try Oracle self contained packaging .您可以尝试 Oracle自包含包装

A self-contained application contains your Java or JavaFX application and the JRE needed to run the application自包含应用程序包含您的 Java 或 JavaFX 应用程序以及运行该应用程序所需的 JRE

Check out the docs查看docs

Use Excelsior JET.使用 Excelsior JET。 It compiles an entire JRE plus your code into an EXE file.它将整个 JRE 和您的代码编译成一个 EXE 文件。 It runs with the bundled JRE inside the exe and does not require a JRE to be installed on Windows.它与 exe 中捆绑的 JRE 一起运行,不需要在 Windows 上安装 JRE。

https://www.excelsiorjet.com/ https://www.excelsiorjet.com/

Because it compiles your code, It also runs faster and cannot be decompiled later.因为它编译你的代码,它也运行得更快,以后不能反编译。 So it adds a layer of protection to your code too which is nice for commercial software.因此,它也为您的代码添加了一层保护,这对于商业软件来说非常有用。

Only drawback is that it is not free (has a 90-day free trial) and each release stops working after 90 days.唯一的缺点是它不是免费的(有 90 天的免费试用期)并且每个版本在 90 天后停止工作。 So you need to buy it if you want to use it as your release solution.因此,如果您想将其用作发布解决方案,则需要购买它。 The Excelsior package also contains an installer creator called JetPack. Excelsior 软件包还包含一个名为 JetPack 的安装程序创建者。

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

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