Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 696
Javier Carmona Avatar asked Jun 11 '15 15:06

Javier Carmona


1 Answers

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.

like image 146
Melvin Avatar answered Oct 23 '22 21:10

Melvin