简体   繁体   中英

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

I have a JAR file that I needed transferred to a Mac. The .cmd file "opens" it, but says that it needed the 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; but the Mac does not have the JDK. I need an answer by Monday [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.

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. You'll want to use a third party program to do this. Something like launch4j which can bundle the JRE with your jar.

http://launch4j.sourceforge.net/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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