title: Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment
body: <p>I use OS X Yosemite (10.10.2) and have some java projects which I want to build in Eclipse. Some projects are old and they are in Java 5, 6 and 7. At first, I installed JDK 7 and Eclipse Luna. Then I read <a href="https://stackoverflow.com/questions/1577014/how-to-install-a-specific-jdk-on-mac-os-x?lq=1">this</a> and <a href="https://stackoverflow.com/questions/2846573/how-to-get-jdk-1-5-on-mac-osx">this</a> thread how to install specific JDK on mac. I used <a href="https://gist.github.com/bric3/1163008" rel="nofollow noreferrer">this</a> script to install JDKs and changed these two lines in order to Yosemite compatibility.</p>
  
  <pre><code>/usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumFrameworkVersion 14.*.*" ./Resources/Info.plist
  /usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumSystemVersion "$osx_version".*" ./Resources/Info.plist
  </code></pre>
  
  <p>by</p>
  
  <pre><code>/usr/libexec/PlistBuddy -c "Delete :JavaVM:JVMMaximumFrameworkVersion" ./Resources/Info.plist
  /usr/libexec/PlistBuddy -c "Delete :JavaVM:JVMMaximumSystemVersion" ./Resources/Info.plist
  </code></pre>
  
  <p>Here is content of my <code>/System/Library/Frameworks/JavaVM.framework/Versions</code> directory</p>
  
  <pre><code>lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.4 -&gt; CurrentJDK
  lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.4.2 -&gt; CurrentJDK
  lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.5 -&gt; CurrentJDK
  lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.5.0 -&gt; CurrentJDK
  drwxr-xr-x  9 root  wheel  306  8 apr 14:32 1.5.0_30
  lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.6 -&gt; CurrentJDK
  lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.6.0 -&gt; CurrentJDK
  drwxr-xr-x  7 root  wheel  238  8 apr 14:36 A
  lrwxr-xr-x  1 root  wheel    1  8 apr 14:36 Current -&gt; A
  lrwxr-xr-x  1 root  wheel   59  8 apr 14:36 CurrentJDK -&gt; /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
  </code></pre>
  
  <p>Location of JDK 7 is different and the path is <code>/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk</code></p>
  
  <p>Default Java version is:</p>
  
  <pre><code>AND:bin andr-work$ java -version
  java version "1.7.0_75"
  Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
  Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
  </code></pre>
  
  <p>Here are installed JDKs in Eclipse preferences</p>
  
  <p><img src="https://i.stack.imgur.com/XWXF2.png" alt="enter image description here"></p>
  
  <p>Version 7</p>
  
  <p><img src="https://i.stack.imgur.com/IM3jq.png" alt="enter image description here"></p>
  
  <p>Version 6</p>
  
  <p><img src="https://i.stack.imgur.com/Kivl0.png" alt="enter image description here"></p>
  
  <p>Version 5</p>
  
  <p><img src="https://i.stack.imgur.com/i6kuN.png" alt="enter image description here"></p>
  
  <p>When I want to build projects in java 6 or 7, I don't have any problems with java compiler in Eclipse</p>
  
  <p><img src="https://i.stack.imgur.com/yRJnb.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/NEqPH.png" alt="enter image description here"></p>
  
  <p>But I cannot build some projects in java 5 and probably compiler for java 5 is not set properly</p>
  
  <p><img src="https://i.stack.imgur.com/yJFD3.png" alt="enter image description here"></p>
  
  <p>I found <a href="http://eyeforthings.blogspot.com/2010/12/on-mac-eclipses-java-compiler-does-not.html" rel="nofollow noreferrer">this</a> blog post with this problem and solution is </p>
  
  <blockquote>
    <p>...replace the "A" subdirectory with files from someone else's Mac</p>
  </blockquote>
  
  <p>but I don't know anybody with working these java versions in Yosemite.</p>
  
  <p>I tried to change Execution Environments in Eclipse preferences</p>
  
  <p><img src="https://i.stack.imgur.com/Z1fPJ.png" alt="enter image description here"></p>
  
  <p>But it didn't help.</p>
  
  <p><strong>Java Build Path</strong> in project properties is <strong>J2SE-1.5</strong> and I tried to change <strong>Execution environment</strong> by <strong>Alternate JRE</strong> </p>
  
  <p><img src="https://i.stack.imgur.com/leDIw.png" alt="enter image description here"></p>
  
  <p>but when I save this settings and open it again <strong>J2SE-1.5</strong> is still Execution environment (J2SE-1.5)</p>
  
  <p>Then I tried to add java <code>source</code> and <code>target</code> in <code>build.xml</code></p>
  
  <pre><code>    &lt;?xml version="1.0"?&gt;
  &lt;project name="build" default="jar"&gt;
      &lt;description&gt;
              A build script
      &lt;/description&gt;
  
      &lt;property name="ant.build.javac.source" value="1.5"/&gt;
      &lt;property name="ant.build.javac.target" value="1.5"/&gt;
  
      &lt;property name="dist.jar" value="ci-ons.jar"&gt;&lt;/property&gt;
      &lt;property name="dist.folder" value="dist"&gt;&lt;/property&gt;
      &lt;property name="src.folder" value="src"/&gt;
      &lt;property name="classes.folder" value="bin"/&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>but it didn't help. </p>
  
  <p>Do you have any idea how can i build projects in java 5 in Eclipse in Yosemite?</p>
  
  <p>EDIT:// The problem was JDK 1.5 path referred to CurrentJDK, what was JDK 1.6. I run installation of JDK 1.5 and 1.6 again and now JDK 1.5 is linked with JDK 1.5</p>
  
  <pre><code>lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.4 -&gt; CurrentJDK
  lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.4.2 -&gt; CurrentJDK
  lrwxr-xr-x  1 root  wheel   10  9 apr 11:01 1.5 -&gt; ./1.5.0_30
  lrwxr-xr-x  1 root  wheel   10  9 apr 11:01 1.5.0 -&gt; ./1.5.0_30
  drwxr-xr-x  9 root  wheel  306  9 apr 11:01 1.5.0_30
  lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.6 -&gt; CurrentJDK
  lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.6.0 -&gt; CurrentJDK
  drwxr-xr-x  7 root  wheel  238  8 apr 14:36 A
  lrwxr-xr-x  1 root  wheel    1  8 apr 14:36 Current -&gt; A
  </code></pre>
  
  <p>In project properties I don't get any warnings of compiler, but apparently JDK 1.5 doesn't have JRE 1.5, because if I open Eclipse preferences Java->Installed JREs->Execution Environments, there is not any JRE 1.5</p>
  
  <p><img src="https://i.stack.imgur.com/s4fwA.png" alt="enter image description here"> </p>
  
  <p>and I cannot build projects in Java 5, because I get errors:</p>
  
  <pre><code>Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment.
  </code></pre>
  
  <p>This is content of <code>/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0_30</code> directory</p>
  
  <p><img src="https://i.stack.imgur.com/ImUz4.png" alt="enter image description here"></p>
  
  <p>I decided to open new <a href="https://stackoverflow.com/questions/29535500/install-jdk-1-5-in-osx-10-10-yosemite">thread</a></p>