0

Which are the .bat file alternatives for Linux, MacOSX and other operating systems for starting a jar file for example or another program (.exe, .app ...) with a click on this .bat / ... file?

I just know .sh, but which operating systems support it natively?

Like the .sh file. Which files work under which OS natively without any external dependencies or libraries (like python)

2 Answers 2

0

Bash works on Linux, MacOSX, BSD and some other unixes usually. How you name the file doesn't really matter, but most people would call it .sh. The important part is that the first line of the file is this:

#!/bin/bash

And the file has to be executable, like with chmod +x.

3
  • they have to set it manually as executable?
    – user81245
    Commented Feb 20, 2013 at 16:07
  • Not recognize as default on windows for sure. Commented Feb 20, 2013 at 16:09
  • for windows there is .bat or what do you mean sputnick?
    – user81245
    Commented Feb 20, 2013 at 16:09
0

Try doing this : https://stackoverflow.com/questions/5270083/forking-a-new-process-in-c-and-executing-a-jar-file

to run it in a wrapper (should works on any platforms):

execlp("java", "java", "-jar", "myprog.jar", (char *)0);
1
  • just bash script, I dont want to compile for each platform a new file. Also they should be able to change / edit the files so bash seems to be the best
    – user81245
    Commented Feb 20, 2013 at 16:07

You must log in to answer this question.