Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Simple batch file to run java program

    I am trying to get a bash file to run a java program with a bunch of arguments.

    This is what I tried

    1. Create a little file >

    2. In the bash file type: echo "java -jar my_Java_app arguments". (To manually run the program I type "java -jar my_Java_app arguments" into the command line.)

    3. Make it executable with chmod +x

    4. Moved it to /usr/bin

    5. Type in terminal

    The terminal just displays the command, but does not execute it.

    I tried program and exec in place of echo.

    Any ideas?

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Seattle, WA, USA
    Bash scripts work as direct input to the shell. So you put into a Bash script the exact lines that you want executed. "echo" prints out its argument, so if you put echo first, it (correctly) just prints out your command.

    So just put the command you want to run.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts