title: Difficulties with updating my Mac to the latest Java JDK
body: <p><strong>[2015-10-12 12:51]</strong></p>
  
  <blockquote>
    <p>Running...</p>
  </blockquote>
  
  <pre><code>little-mbook1:platform mlittle$ ant clean all
       Error: JAVA_HOME is not defined correctly.
         We cannot execute   /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home//bin/java
  </code></pre>
  
  <blockquote>
    <p>And running...</p>
  </blockquote>
  
  <pre><code>mlittle-mbook1:bin mlittle$ export   JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
  </code></pre>
  
  <blockquote>
    <p>I set java_home to:
    JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home</p>
    
    <p>I have just noticed that Apache Ant is looking in the wrong path, with an additional ‘/'</p>
    
    <p>And according to your email</p>
    
    <p>“ Ant will try to use the file $JAVA_HOME/bin/java. If that doesn't exist, then > JAVA_HOME is not correct, it's that simple. If for example your java executable > is at /path/to/whatever/bin/java, then JAVA_HOME should be /path/to/whatever.”</p>
    
    <p>or… 
        $JAVA_HOME/bin/java</p>
    
    <p>but the error message indicates that it is looking in the path..</p>
  </blockquote>
  
  <pre><code>$JAVA_HOME//bin/java
  </code></pre>
  
  <blockquote>
    <p><strong>Notice the ‘//‘ instead of ‘/‘: how to correct this?</strong> </p>
    
    <p>Or is there an ‘ant’ command, where I can force it to look in the correct path? </p>
  </blockquote>
  
  <p><strong>=================</strong></p>
  
  <p>[2015-10-12: 1204]</p>
  
  <blockquote>
    <p>Thank you, you have resolved one issue for me, I understand that /java is an executable in the path $java_home/bin/java, not a folder
    As for $JAVA_HOME/bin/java -version, 
    I got the following...</p>
  </blockquote>
  
  <pre><code>mlittle-mbook1:~ mlittle$ /usr/libexec/java_home -v
  java_home: option requires an argument -- v
  /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
  mlittle-mbook1:~ mlittle$ which java
  /usr/bin/java
  </code></pre>
  
  <blockquote>
    <p>Now re-running ant to attempt to build the hybris instance...</p>
  </blockquote>
  
  <pre><code>mlittle-mbook1:~ mlittle$ cd 00hybris/hybris/bin/platform
  mlittle-mbook1:platform mlittle$ pwd
  /Users/mlittle/00hybris/hybris/bin/platform
  mlittle-mbook1:platform mlittle$ . ./setantenv.sh
  mlittle-mbook1:platform mlittle$ ant clean all
  Error: JAVA_HOME is not defined correctly.
  We cannot execute   /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home//bin/java
  </code></pre>
  
  <blockquote>
    <p>As you can see, I am still having problems with 'ant' despite having what now appears the correct $java_home location. </p>
  </blockquote>
  
  <h1>=======</h1>
  
  <p>=======</p>
  
  <p>[2015-10-11-23:20]
  FURTHER INVESTIGATION</p>
  
  <pre><code>mlittle-mbook1:Users mlittle$ cd   
  /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
  
  mlittle-mbook1:Home mlittle$ pwd
  /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
  
  mlittle-mbook1:Home mlittle$ ls -a
  .                   README.html             db                  lib
  ..                  THIRDPARTYLICENSEREADME-JAVAFX.txt  include         man
  COPYRIGHT               THIRDPARTYLICENSEREADME.txt     javafx-src.zip release
  LICENSE                 bin                 jre                 src.zip
  
  mlittle-mbook1:Home mlittle$ cd bin
  
  mlittle-mbook1:bin mlittle$ ls -a
  .       jar     javafxpackager  jconsole    jjs     jsadebugd   keytool rmic servertool xjc
   ..     jarsigner   javah       jdb     jmap        jstack      native2ascii    rmid        tnameserv
  appletviewer    java        javap       jdeps       jmc     jstat       orbd        rmiregistry unpack200
  extcheck    javac       javapackager    jhat        jps     jstatd      pack200     schemagen   wsgen
  idlj        javadoc     jcmd        jinfo       jrunscript  jvisualvm   policytool  serialver   wsimport
  
  mlittle-mbook1:bin mlittle$ which java
  /usr/bin/java
  mlittle-mbook1:bin mlittle$ export    JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
  mlittle-mbook1:bin mlittle$ java -version
  java version "1.8.0_60"
  Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
  Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
  mlittle-mbook1:bin mlittle$ 
  </code></pre>
  
  <p>====</p>
  
  <pre><code> mlittle-mbook1:platform mlittle$ ant clean all
   Error: JAVA_HOME is not defined correctly.
     We cannot execute   /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home//bin/java
  mlittle-mbook1:platform mlittle$* 
  </code></pre>
  
  <p>==
  INITIAL INVESTIGATION</p>
  
  <p>I seem to have a problem with my Java installation on my MacBook, as this relates to the installation of a java based eCommerce platform [ <a href="https://stackoverflow.com/questions/33006794/difficulties-with-installation-script-for-hybris-5-6-02/33039004#33039004">Difficulties with installation script for hybris 5.6.02</a> ] and the use of Apache Ant...</p>
  
  <ol>
  <li>Regarding my MacBook..
  System Software Overview:     </li>
  </ol>
  
  <blockquote>
    <p>System Version:    OS X 10.10.5 (14F27)<br>
    Kernel Version: Darwin 14.5.0<br>
    Boot Volume:    Macintosh HD<br>
    Boot Mode:  Normal<br>
    Computer Name:  mlittle-mbook1<br>
    User Name:  mlittle-mbook1 (mlittle)<br>
    Secure Virtual Memory:  Enabled<br>
    Time since boot:    1 day5:34  </p>
  </blockquote>
  
  <p>=========</p>
  
  <p><strong>1. Checked which java…</strong></p>
  
  <pre><code>mlittle-mbook1:~ mlittle$ which java
  /usr/bin/java
  </code></pre>
  
  <p> <strong>2. Recheck which Java..</strong></p>
  
  <p> </p>
  
  <pre><code>mlittle-mbook1:~ mlittle$ ls -l `which java`
  lrwxr-xr-x  1 root  wheel  74  5 Nov  2014 /usr/bin/java -&gt; /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
  </code></pre>
  
  <p> 
  <strong>3. I then downloaded the JDK version 8, update 60, and so in the path:</strong></p>
  
  <p>/Library/Java/Java?JavaVirtualMachines</p>
  
  <p>Previously it had..</p>
  
  <blockquote>
    <p>/jdk1.7.0_21.jdk</p>
  </blockquote>
  
  <p>Now It has </p>
  
  <blockquote>
    <p>/jdk1.7.0_21.jdk<br>
    /jdk1.8.0_60.jdk</p>
  </blockquote>
  
  <p>This is confusing, I was expecting that it would replace  /jdk1.7.0_21.jdk
   with  /jdk1.8.0_60.jdk</p>
  
  <p><strong>4. I check the version of java..</strong> </p>
  
  <pre><code>mlittle-mbook1:~ mlittle$ java -version
  java version "1.7.0_21"
  mlittle-mbook1:~ mlittle$ java -version
  java version "1.7.0_21"
  Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
  Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
  </code></pre>
  
  <p>It was still indicating java version “1.7.0_21"???</p>
  
  <p>And so I renamed /jdk1.7.0_21.jdk to /old-jdk1.7.0_21.jdk</p>
  
  <p><strong>4. I again check the version of java, and then I got…</strong></p>
  
  <pre><code>mlittle-mbook1:~ mlittle$ java -version
  java version "1.8.0_60"
  Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
  Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
  </code></pre>
  
  <p><strong>5. Which should be the correct version of Java for Hybris5.6.0.2 [this the java based eCommerce platform that I am trying to install] by setting the ANT environment variables, and commence the build process [ant clean all]… but…</strong></p>
  
  <pre><code>mlittle-mbook1:platform mlittle$ . ./setantenv.sh
  </code></pre>
  
  <p> 
  Tried to ant clean all.. and got an error message relating to JAVA_HOME<br>
   </p>
  
  <pre><code>mlittle-mbook1:platform mlittle$ ant clean all
  Error: JAVA_HOME is not defined correctly.
    We cannot execute /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home//bin/java
  </code></pre>
  
  <p> 
   <strong>6. Again checked the java path…</strong></p>
  
  <pre><code>mlittle-mbook1:platform mlittle$ which java
  /usr/bin/java
  </code></pre>
  
  <p> </p>
  
  <p> <strong>7. I tried to change the Java_home path and then re-run ANT.</strong>.</p>
  
  <pre><code>mlittle-mbook1:platform mlittle$ export JAVA_HOME=/Library/Java/Home
  mlittle-mbook1:platform mlittle$ ant clean all
  Error: JAVA_HOME is not defined correctly.
    We cannot execute /Library/Java/Home/bin/java
  </code></pre>
  
  <p> 
   <strong>8. Again checked “which Java”</strong></p>
  
  <pre><code>mlittle-mbook1:platform mlittle$ which java
  /usr/bin/java
  mlittle-mbook1:platform mlittle$ $JAVA_HOME/bin/java -version
  -bash: /Library/Java/Home/bin/java: No such file or directory
  </code></pre>
  
  <p> 
  <strong>9.I tried to change the Java_home, reran Ant, but still got an error message..</strong></p>
  
  <pre><code>mlittle-mbook1:platform mlittle$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/
  mlittle-mbook1:platform mlittle$ ant clean all
  Error: JAVA_HOME is not defined correctly.
    We cannot execute /Library/Java/JavaVirtualMachines//bin/java
  </code></pre>
  
  <p><strong>10. 9.I tried to change the Java_home, reran Ant, but still got an error message..</strong></p>
  
  <pre><code>mlittle-mbook1:platform mlittle$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin
  mlittle-mbook1:platform mlittle$ ant clean all
  Error: JAVA_HOME is not defined correctly.
    We cannot execute /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/bin/java
  </code></pre>
  
  <p> 
  <strong>11. Again checked which java</strong></p>
  
  <pre><code>mlittle-mbook1:platform mlittle$ which java
  /usr/bin/java
  </code></pre>
  
  <p>I am confused, clearly I do not have my java set home variables set up properly: any suggestions? </p>