title: Mac launcher script for Java app
body: <p><p><b>I need to launch a Jar file with a portable JRE. </b> It works on Windows thanks to launch4j, it works on Ubuntu thanks to me, but not on Mac ..... and I can't test it. </p>
  
  <p>The path tree of application:</p>
  
  <pre>
      abcmap/
            launcher.command
            bin/
                abcmap.jar
                jre/
                    bin/
                        java
  </pre>
  
  <p>Thinking it's like Unix system, I tried this (without specify bash):</p>
  
  <pre><code>./bin/jre/bin/java -Xms512m -Xmx1024m -jar ./bin/abcmap.jar
  </code></pre>
  
  <p>But this error appear:</p>
  
  <pre><code>    MacBook-Pro:~ frcstnt$ /Applications/abcmap-mac/abcmap.command; 
      exit;
      /Applications/abcmap-mac/abcmap.command: line 1:
      bin/jre/bin/java: No such file or directory
      logout
  </code></pre>
  
  <p><p>All files are rwx for all, 
  <br>All files are UTF8 without BOM
  <br>I tried to change end of line to Unix and to "Old Mac" with Notepad++,</p>
  
  <p><p>Archives are available on my website: 
  <br><a href="http://abc-map.fr/download/" rel="nofollow">http://abc-map.fr/download/</a>
  <br><a href="https://translate.google.fr/translate?hl=fr&amp;sl=fr&amp;tl=en&amp;u=http%3A%2F%2Fabc-map.fr%2F" rel="nofollow">https://translate.google.fr/translate?hl=fr&amp;sl=fr&amp;tl=en&amp;u=http%3A%2F%2Fabc-map.fr%2F</a></p>
  
  <p><p>Someone can help me please?</p>
  
  <p><p><strong>Edit:</strong> I think my problem is in the launcher, maybe encoding or bad command ?</p>
  
  <p><p><strong>Edit:</strong> Thanks to the Wim's answer it works. This is the script:</p>
  
  <pre><code>#!/bin/bash 
  SCRIPTDIR=$(dirname $0) 
  cd $SCRIPTDIR 
  ${SCRIPTDIR}/bin/jre/bin/java -jar ${SCRIPTDIR}/bin/abcmap.jar
  </code></pre>