Command line Java slick application?

I want to make a smooth java command line application that does not include all the nasty "java -jar some.jar arguments"

instead, I would work like

program -option argument

like any other command line application. I am using ubuntu linux and it would be nice if it included a little .sh script or something else. I know that I can just create a file with java -jar program.jarand do chmod +x file, after which I could start I with. / file, but then how can I pass arguments to the program?

+5
source share
3 answers

Using

java -jar program.jar $1 $2 $3

to access the 1st, 2nd and 3rd argument of the script.

http://www.ibm.com/developerworks/library/l-bash2.html

#!/usr/bin/env bash

echo name of script is $0
echo first argument is $1
echo second argument is $2
echo seventeenth argument is $17
echo number of arguments is $#

, , , @nos :

java -jar program.jar "$@"
+12

Linux binfmt.

0

, , bash, , Java , .

, , .

0

All Articles