Running jar file via .command file

Discussion in 'Mac Programming' started by JavaWizKid, Jul 24, 2011.

  1. JavaWizKid, Jul 24, 2011
    Last edited: Jul 24, 2011

    JavaWizKid macrumors 6502a

    Joined:
    Sep 18, 2008
    #1
    How can I do this?

    #!/bin/bash
    java -jar -Djava.library.path=lib CastleWars.jar

    It errors with unable to access CastleWars.jar

    How can I get unix to recognise where the .command file is being launched from and then put that path in front of CastleWars.jar?

    GOT IT!
    #!/bin/bash
    java -jar -Djava.library.path="$_/../"lib "$_/../"CastleWars.jar
     
  2. mrbash macrumors 6502

    Joined:
    Aug 10, 2008
    #2
    Shouldn't it be?:
    Code:
    java  -Djava.library.path=lib  -jar CastleWars.jar
    
     

Share This Page