From 8a52b231d24c0fdfdf229ecb1706e78a1885c118 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Wed, 2 Apr 2014 18:15:10 -0700 Subject: [PATCH] Unset _JAVA_OPTIONS before running "java -version". Unfortunately the previous approach of grepping out java version before "head -n 1" clash with the effort of running "java -version" only once. Change-Id: Ic78719c3bf1a54a45342d74bbbfa8e83bbc1bce1 --- core/main.mk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/main.mk b/core/main.mk index ec5721e60..0ef05f152 100644 --- a/core/main.mk +++ b/core/main.mk @@ -151,8 +151,8 @@ requires_openjdk := true endif endif -java_version_str := $(shell java -version 2>&1) -javac_version_str := $(shell javac -version 2>&1) +java_version_str := $(shell unset _JAVA_OPTIONS && java -version 2>&1) +javac_version_str := $(shell unset _JAVA_OPTIONS && javac -version 2>&1) # Check for the current jdk ifeq ($(requires_openjdk), true) @@ -187,13 +187,13 @@ endif # if requires_openjdk ifneq ($(EXPERIMENTAL_USE_JAVA7),) required_version := "1.7.x" required_javac_version := "1.7" -java_version := $(shell echo '$(java_version_str)' | grep '^java .*[ "]1\.7[\. "$$]' | head -n 1) -javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.7[\. "$$]' | head -n 1) +java_version := $(shell echo '$(java_version_str)' | grep '^java .*[ "]1\.7[\. "$$]') +javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.7[\. "$$]') else # if EXPERIMENTAL_USE_JAVA7 required_version := "1.6.x" required_javac_version := "1.6" -java_version := $(shell echo '$(java_version_str)' | grep '^java .*[ "]1\.6[\. "$$]' | head -n 1) -javac_version := $(shell echo '$(javac_version_str)' | head -n 1 | grep '[ "]1\.6[\. "$$]' | head -n 1) +java_version := $(shell echo '$(java_version_str)' | grep '^java .*[ "]1\.6[\. "$$]') +javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.6[\. "$$]') endif # if EXPERIMENTAL_USE_JAVA7 ifeq ($(required_javac_version), "1.6")