title: java.lang.UnsupportedClassVersionError: com/google/doclava/Doclava : Unsupported major.minor version 51.0 android build
body: <p>I am trying to build by own AOSP from google source. I follwed the steps mentioned in the Google Documents and was successfully able to build it and flash my device with the images successfully. However, I tried building it again after making some changes (basically just added some Logs to play around with it). The build errored out. I then tried to make again, it said <strong>Javac 1.6 found. Required Javac 1.7</strong>. I then followed the answers for this particular problem by using the following command: </p>
  
  <pre><code> update-alternatives --config javac
  There are 2 choices for the alternative javac (providing /usr/bin/javac).
  
    Selection    Path                                         Priority   Status
  ------------------------------------------------------------
    0            /usr/lib/jvm/java-7-openjdk-amd64/bin/javac   1051      auto mode
  * 1            /usr/lib/jvm/j2sdk1.6-oracle/bin/javac        315       manual mode
    2            /usr/lib/jvm/java-7-openjdk-amd64/bin/javac   1051      manual mode
  </code></pre>
  
  <p>I then selected the option 0. I then tried to make again. This time it failed with the following error:</p>
  
  <pre><code>java.lang.UnsupportedClassVersionError: com/google/doclava/Doclava : Unsupported major.minor version 51.0 android build
  </code></pre>
  
  <p>After going through the all answers for this question(I found this asked so many times), I found it is because the complie time(higher version) and run time(lower version) JDK dont match and I should recompile it using Java 1.7.  How do I do that for android build? I am also surprized why I got the error "Javac 1.6 found. Required Javac 1.7." as I successfully created the build using Java 1.6. </p>