Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created one java application which takes number of external jar files and also VM arguments passed to it.

I want to create .sh file for that application so that I cat run it on any linux system.

Please suggest me any tool to create .sh file in linux and which will also takes care about the arguments which has to be pass to application to run it.

I have use the tool named JarSplice but its not working as there is problem in loading libraries after creation of sh file .

So please suggest any tool for that.

share|improve this question
It is unclear what you want to achieve. Do you want to build a self-extracting archive or a package to be able to transfer your program as a single file to other systems? Or just a shortcut that you don't need to type all the options when you want to run it? – January Jun 27 '13 at 14:25
I have created the jar file for that application and now i want to convert that jar into sh file.Is there any tool to convert the jar to sh in linux?? – rachana Jun 28 '13 at 8:50
up vote 0 down vote accepted

OK, I think there is a misunderstanding as to what a ".sh" file is. This is a shell script, equivalent to a .bat file in DOS (but much more powerful), a piece of text that is read and executed by the program called "shell" (for example, bash). All you need to do is to save a text file and set the permissions to "executable". It might look like this:


echo "Hello world"

Or, it might be a wrapper around a jar file:


java -jar YourJarFile.jar

There are ways to encode a binary file into a shell script such that when the shell script is run, it will create the binary file -- a kind of self-extracting archive. But it is not possible to "convert jar to sh". Also, it is kind of useless.

You can just carry your jar file around. Wrapping it around in a shell script is not really useful, since running it is as simple as writing

java -jar YourJarfile.jar
share|improve this answer

Your Answer


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.