Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Script to run .jar file on Mac OS X

I want to run batch file (similar to Windows) on Mac OS X to run a jar file, after search I found it run batch script.

I am not getting proper link from where I can take help. How can I create this?

like image 258
Neelam Sharma Avatar asked Jan 29 '13 10:01

Neelam Sharma


3 Answers

You could create a shell script and run it with Terminal.

For example:

#!/bin/sh
java -jar path/to/jar/file.jar

To run it you need to set up the right user permission, so do chmod u+x script-name then run with ./script-name

like image 200
supes Avatar answered Sep 30 '22 20:09

supes


You have to create a shell script on MAC OS to get the same result as with a batch file on Windows.

A shell script could look like this:

#!/bin/bash
/opt/java/jre-7x/bin/java -jar /your/path/to/jar-file

Please note that the path to the java executable depends on your java installation directory.

like image 45
flash Avatar answered Sep 30 '22 19:09

flash


You can't run a batch file, but you can run a shell script which is the equivalent on unix based systems.

Like the batch file, the shell script is also platform specific, but should work on Unix and Linux based systems.

like image 37
Michael Berry Avatar answered Sep 30 '22 20:09

Michael Berry