简体   繁体   English

为 make OS X 设置 JDK 路径

[英]Setting JDK Path for make OS X

I am trying to build Android AOSP on Mac OS X 10.13.6我正在尝试在 Mac OS X 10.13.6 上构建 Android AOSP

When running make it outputs运行时make输出

build/core/config.mk:601: *** Error: could not find jdk tools.jar at /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/../lib/tools.jar, please check if your JDK was installed correctly.  Stop.

JAVA_HOME and ANDROID_JAVA_HOME are both set to the directory of my JDK installation: JAVA_HOMEANDROID_JAVA_HOME都设置为我的 JDK 安装目录:

/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home

I know that the files under System/Library/.../Commands are stubs pointing to the correct JDK installation but make tries to find the tools.jar in this directory, too.我知道System/Library/.../Commands下的文件是指向正确 JDK 安装的存根,但make也会尝试在此目录中找到tools.jar

Is there a way to tell make to search in the right directory?有没有办法告诉make在正确的目录中搜索?

EDIT编辑

Error appears in config.mk:601 config.mk:601 中出现错误

# We may not have the right JAVA_HOME/PATH set up yet when this is run from envsetup.sh.
ifneq ($(CALLED_FROM_SETUP),true)
HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)

ifneq ($(HOST_JDK_TOOLS_JAR),)
ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
$(error Error: could not find jdk tools.jar at $(HOST_JDK_TOOLS_JAR), 
please check if your JDK was installed correctly)
endif
endif

But when running find-jdk-tools-jar.sh it outputs the correct path, where the tools.jar is indeed located.但是在运行find-jdk-tools-jar.sh它会输出正确的路径,即 tools.jar 确实位于的位置。 So make uses some other fallback?所以 make 使用了一些其他的回退?

On OSX, /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/ is not where JDK root is.在 OSX 上,/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/ 不是 JDK 根所在的位置。 JDK install home is usually /Library/Java/JavaVirtualMachines/jdk[whatever you have installed].jdk/Contents/Home JDK 安装主页通常是 /Library/Java/JavaVirtualMachines/jdk[whatever you have installed].jdk/Contents/Home

You need to configure your JAVA_HOME correctly.您需要正确配置您的 JAVA_HOME。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM