Hi,
recently I had the exact same problem.
Here is how I solved, thanks to Chih-Wei instructions in another post (link this post).
With kitkat-x86 you need Oracle JDK 6 installed:sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer
If you have other JDK/versions installed, if you don't know check anyway, you'll have to setup java, javac and javap alternatives
The last one, javap, isn't even mentioned in AOSP Build Environment webpage, but it is indeed fundamental,
considering also this post
https://groups.google.com/forum/#!searchin/android-x86/Surface_jni.h/android-x86/Qz6Hx1JtTvk/JXrHzF7VET4Jsudo update-alternatives --config java
...
There are 6 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-oracle/jre/bin/java 1072 auto mode
1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode
* 2 /usr/lib/jvm/java-6-oracle/jre/bin/java 1 manual mode
3 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
4 /usr/lib/jvm/java-7-oracle/jre/bin/java 2 manual mode
5 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1069 manual mode
6 /usr/lib/jvm/java-8-oracle/jre/bin/java 1072 manual mode
Press enter to keep the current choice[*], or type selection number:
NOTE: you'll need to inspect your output, to set the correct choice.
Repeat for javac and javap:
sudo update-alternatives --config javac
sudo update-alternatives --config javap <= remember this one
In case of lollipop-x86 build you need to install OpenJDK 7
sudo apt-get install openjdk-7-jdk
and setup java, javac and javap alternatives as
* /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java*
The javap alternative misconfiguration is very nasty to troubleshoot, thanks a lot Chih-Wei for his earlier post.
Mauro