简体   繁体   中英

Running jar file with no preinstalled Java on Mac machine

Running jar file with embedded Java. No preinstalled java in the Mac machine.

I need to run a jar file in Mac OS X, where there is no Java installed. I have downloaded the portable Java for Mac. But can't able to run that from shell command. Please help me to run the jar using portable, embedded Java.

What error are you getting? Does your shell script include a JAVA_HOME variable or another variable of that sort?

Such a variable would have to be set to point to the instance of java that you have installed, assuming you have the correct version required by your application.

without a JRE on the machine, you CANNOT run a .jar file. You'd have to use some sort of tool (ie. Launch4j) to create a native binary. Most of these tools will create a native executable which embeds the JVM (dll, so, etc...) and use C/C++ code to initialize a jvm instance. Once the jvm is initialized, it can run your code.

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