Adam Ranganathan
Adam Ranganathan

Reputation: 1717

How to run jar files in Mac using JRE?

Mac OSX 10.11.14 (El Capatin) does not ship with Java, either the complete development kit (JDK) or the run-time environment (JRE). My need was to just run a .jar file and not for complete Java development. So I downloaded the JRE from here, which is a much smaller file compared to JDK (quite obviously).

This SO answer says that JRE is enough to run jar files.

After installation of JRE I couldn't locate the directory where installation happened or run java command to execute files on my mac. How do I run jar files now?

Upvotes: 0

Views: 7667

Answers (2)

David
David

Reputation: 3055

To run java application you can either use

/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

or (as you found)

/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java

In any case, if you need to run java often, you should set JAVA_HOME in either your ~/.bash_profile or ~/.profile and amend the PATH to include the bin directory.

Upvotes: 1

Adam Ranganathan
Adam Ranganathan

Reputation: 1717

After JRE installation, the correct path is:

/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin

But now, how do I run the java command? It seems like the java file located in the directory above is not an executable.

Upvotes: 0

Related Questions