Java Problems

1,614 views
Skip to first unread message

Jörg Giese

unread,
Jul 19, 2015, 8:24:18 PM7/19/15
to android-...@googlegroups.com
I try to run the make comman and i get the following error

============================================
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.
 
Your version is: Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar  java version "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode).
The required version is: "1.7.x"
 
Please follow the machine setup instructions at
************************************************************

java -version
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

What did I wrong?



Dave Smith

unread,
Jul 20, 2015, 1:36:11 AM7/20/15
to android-...@googlegroups.com

The Makefile parses the output of 'java -version' and scrapes for the version number. It is having trouble parsing the output because your command returns a strange value based on your JAVA_TOOL_OPTIONS setting.

First step to try would be to set your JAVA_HOME to the root directory of your selected JDK. This will take precedence over the JAVA_TOOL_OPTIONS it is currently picking up.

On many host systems (e.g. Ubuntu), building the latest version actually requires OpenJDK (rather than Oracle). You might try that also.

Dave Smith, PE
@devunwired

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jörg Giese

unread,
Jul 20, 2015, 9:38:59 AM7/20/15
to android-...@googlegroups.com
I have tried with OpenJDK too,

But i get the same error-message:

============================================
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.
 
Your version is: Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar  java version "1.7.0_79" OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu1) OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode).

The required version is: "1.7.x"
 
Please follow the machine setup instructions at
    https://source.android.com/source/initializing.html
************************************************************
wintux@potheadz-vm:~/android-x86$ java -version

Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu1)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
wintux@potheadz-vm:~/android-x86$ sudo update-alternatives --config java
Es gibt 2 Auswahlmöglichkeiten für die Alternative java (welche /usr/bin/java bereitstellen).
  Auswahl      Pfad                                            Priorität Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-7-oracle/jre/bin/java          1072      automatischer Modus
* 1            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      manueller Modus
  2            /usr/lib/jvm/java-7-oracle/jre/bin/java          1072      manueller Modus
Drücken Sie die Eingabetaste, um die aktuelle Wahl[*] beizubehalten,
oder geben Sie die Auswahlnummer ein: 

First step to try would be to set your JAVA_HOME to the root directory of your selected JDK. This will take precedence over the JAVA_TOOL_OPTIONS it is currently picking up.

How can change JAVA_HOME?

Dave Smith

unread,
Jul 20, 2015, 10:46:04 AM7/20/15
to android-...@googlegroups.com
$ export JAVA_HOME = /path/to/jdk/directory

The path would be something like /usr/java/jdk1.7.0_79/bin/java, it's the directory where the java and javac binaries are found.

You could also try unsetting JAVA_TOOL_OPTIONS inside the build shell so the Ubuntu alternatives config gets picked up (i.e. what you are setting with update-alternatives):

$ unset JAVA_TOOL_OPTIONS

I believe this option gets set by Android Studio, so you may not be able to remove it permanently with bigger issues. On the 5.x branches, the build system runs the following command on the output of java -version to determine if you have a correct (1.7.x) version:

grep '^java .*[ "]1\.7[\. "$$]')

…and the following command on javac -version:

grep '[ "]1\.7[\. "$$]')

If either of these commands return empty, it throws the Wrong Java Version error. It's failing on your output because the string it's looking for (java version "1.7.0_79") is not at the beginning of the line.
--
Dave Smith, PE
@devunwired

Sreedevi Jagannath

unread,
Nov 20, 2015, 1:36:33 AM11/20/15
to Android Building
Thanks @Dave Smith. I finally understood the error.
Reply all
Reply to author
Forward
0 new messages