Javier Carmona
Javier Carmona

Reputation: 547

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.

Upvotes: 6

Views: 23871

Answers (1)

Melvin
Melvin

Reputation: 106

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.

Upvotes: 8

Related Questions