简体   繁体   English

如何在没有 Java JDK 的情况下运行 Runnable Jar 文件?

[英]How do I run a Runnable Jar File without Java JDK?

I have a JAR file that I needed transferred to a Mac.我有一个需要传输到 Mac 的 JAR 文件。 The .cmd file "opens" it, but says that it needed the Java JDK. .cmd 文件“打开”了它,但说它需要 Java JDK。 Is there any way around this?有没有办法解决? The file runs perfectly when I double click the JAR file and when I run the .cmd file on my PC;当我双击 JAR 文件在我的 PC 上运行 .cmd 文件时,该文件运行良好; but the Mac does not have the JDK.但是 Mac没有JDK。 I need an answer by Monday [1/12/2015].我需要在星期一 [1/12/2015] 之前得到答复。

You need the JRE, not the JDK (although the JDK will work too as the JRE is a subset of the JDK) to run a JAR file.您需要 JRE,而不是 JDK(尽管 JDK 也可以工作,因为 JRE 是 JDK 的一个子集)来运行 JAR 文件。

That said, if you want your jar file to run without the end user having the JRE installed then you'll need to include the JRE with the jar.也就是说,如果您希望您的 jar 文件在最终用户没有安装 JRE 的情况下运行,那么您需要在 jar 中包含 JRE。 You'll want to use a third party program to do this.您将需要使用第三方程序来执行此操作。 Something like launch4j which can bundle the JRE with your jar.像launch4j这样的东西可以将JRE与您的jar捆绑在一起。

http://launch4j.sourceforge.net/ http://launch4j.sourceforge.net/

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

相关问题 我在eclipse上有一个程序,并将其导出为可运行的JAR文件,如何双击运行它? - I have a program on eclipse and exported it as a runnable JAR file, how do I run it on a double click? 当我将Java导出为可运行的jar文件时,不起作用 - When i export my java as runnable jar file, do not work 如何在Ubuntu 11.10上正确配置Oracle Java JDK 7(不是Open JDK)并运行带有引用的JAR文件的Java程序? - How do I configure Oracle Java JDK 7 (not Open JDK) correctly on Ubuntu 11.10 and run a Java Program with referenced JAR files? 如何使用 eclipse 将类路径添加到导出的可运行 java.jar 文件 - how do I add classpath to the exported runnable java .jar file using eclipse 如何使用 Maven (JDK11 和 Z47A64778888B01C2C2 项目) package 运行 jar 文件 - How can I package a runnable jar file with Maven (JDK11 and JavaFX project) 在Mac上没有JDK的情况下如何运行主jar? - How can I run main jar without JDK on a Mac? 在未安装JDK的情况下运行jar文件 - Run a jar file without JDK installed 在没有 JDK 的 PC 上执行可运行的 JAR - executing runnable JAR on PC's without JDK 如何在runnable jar文件中运行音乐 - How to run music in runnable jar file 如何打包 java jar 文件以在未安装 JRE 的情况下在 Mac 上运行? - How do I package a java jar file to run on a Mac without JRE installed?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM