Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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)

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
    
they have to set it manually as executable? –  Daniel Ruf Feb 20 '13 at 16:07
    
Not recognize as default on windows for sure. –  sputnick Feb 20 '13 at 16:09
    
for windows there is .bat or what do you mean sputnick? –  Daniel Ruf Feb 20 '13 at 16:09
add comment

Try doing this : http://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);
share|improve this answer
    
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 –  Daniel Ruf Feb 20 '13 at 16:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.