Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a .jar in mac?

Tags:

java

macos

jar

I've written a relatively simple java application. I have JDK on my PC, but I need it to run on a mac for school. The .jar runs perfectly on my PC, but I tested it on my Macintosh (which, BTW, does not have JDK installed).

Why isn't it running on mac? How can I fix this? Is fixing it even possible?

like image 835
user2426434 Avatar asked May 30 '13 04:05

user2426434


People also ask

Where is Jar launcher on Mac?

Jar Launcher is located in /System/Library/CoreServices/Jar Launcher. app as part of Apple Computer's Java implementation, installed by default on Mac OS X (not from 10.11 - see link).


1 Answers

You don't need JDK to run Java based programs. JDK is for development which stands for Java Development Kit.

You need JRE which should be there in Mac.

Try: java -jar Myjar_file.jar

EDIT: According to this article, for Mac OS 10

The Java runtime is no longer installed automatically as part of the OS installation.

Then, you need to install JRE to your machine.

like image 115
Hardik Mishra Avatar answered Oct 02 '22 19:10

Hardik Mishra