简体   繁体   中英

Open jar file using JRE on Mac

I have a jar file that is meant to be ran through the command line.

I am not planning to do any java development on the machines where the application will run and my thought process is that therefore I should only need the JRE and not the JDK. In addition, the JDK is like 4x as big as the JRE and I would like to not have to download it.

When installing the JRE on a Mac, it does not set the path for the java command and if I try to run it, osx prompts me to install the JDK.

I wonder if anyone could provide some insight as to how to use the java command in a mac without having the download the bigger sized JDK?

Thanks a lot.

Have you tried running this in terminal?

java -jar MyJarName.jar

However, you can also try and make a runnable application of the jar file. Take a look at Packaging a Java App for Distribution on a Mac

EDIT: You can also try running your starter class from the terminal. cd to the bin folder of your project, then java packageName.className . For example, java my.package.Starter .

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