Neelam Sharma
Neelam Sharma

Reputation: 2855

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?

Upvotes: 12

Views: 45234

Answers (6)

supes
supes

Reputation: 391

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

Upvotes: 23

Mohsin Javed Cheema
Mohsin Javed Cheema

Reputation: 698

Wine for Mac OS X

This would run windows programs on Mac OS X, try this and let me know.

Upvotes: -1

codingFriend1
codingFriend1

Reputation: 6807

Batch files are Windows-only. However it should be easy to convert that batch file to a unix shell script. You find a guide on how to use shell scripts on https://developer.apple.com/library/mac/#documentation/opensource/conceptual/shellscripting/Introduction/Introduction.html

Upvotes: 0

Michael Berry
Michael Berry

Reputation: 72254

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.

Upvotes: 2

flash
flash

Reputation: 6810

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.

Upvotes: 3

TheWhiteRabbit
TheWhiteRabbit

Reputation: 15758

you CAN'T , because its language specific.

you need to write shell script (or manually matching the windows commands with unix/mac os x commands)

Upvotes: -1

Related Questions