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
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With