[英]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.