bash - Where to put files for a command-line Java program? -
i have written java program takes in arguments , executes. pass in these arguments command line (i on macbook pro using terminal, using bash shell). let's name of program prgm. want able "prgm " directory in shell , have program execute. figure need write bash script reference java files , take in arguments, , put bash script somewhere in path. put bash file, , put java files? also, right assume need .class (binary) java files?
step-by-step:
- assuming name of java executable if
myjavaprog. - assuming name of bash script
myscript. - make sure
myscriptcallingmyjavaprogusing absolute path , desired arguments. - call
echo $path, see bunch of paths:/some/path1:/some/other/path2:... - put bash script in whatever path want ones returned
echo $path. - go random path.
- call bash script
bash myscript. see execution ofmyjavaprog.
tips:
- if java program personal use only, put in path starting
/usr/or in$homedirectory (and add locationpath) - if java program must shared other users, put in accessible place, other users don't need modify
pathvariable.
Comments
Post a Comment