Reputation: 9745
I'm using a bat file to run my jar. The code in my bat file is this :
@echo off
java -cp analyser.jar be.model.Start
pause
This works fine for windows.
But it doesn't do anything at linux. I also need to be sure it will run on Mac
Upvotes: 6
Views: 445
Reputation: 16521
For Linux, why not use a .sh
(shell) file?
As Biggs~ alreay said, the actual Java call should remain the same.
Update:
You will also have to make it executable by changing it's user permissions. To do this, use: chmod +x thescript.sh
Upvotes: 3
Reputation: 16757
Bat files are specific to Windows. You would need to execute the command in Linux and Mac in a manner that is specific to those platforms. The actual java call should work the same, I believe. The one change to the java line would be if you had multiple items in the classpath. In that case, you would need to use a colon as a separator instead of a semicolon (which is what Windows uses). (Thanks to khachik for that tip)
For Linux, you would use Shell programming using a BASH script. Here is a link that will describe what you need to do:
http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
For Mac, you would probably use an AppleScript. Here is an article on how to get started with AppleScripts:
http://www.macosxautomation.com/applescript/firsttutorial/index.html
Upvotes: 5