MacOS Mojave(10.14)到Lion(10.7)的JAVA_HOME在哪里? [英] Where is JAVA_HOME on macOS Mojave (10.14) to Lion (10.7)?

查看:98
本文介绍了MacOS Mojave(10.14)到Lion(10.7)的JAVA_HOME在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java是最新版本macOS上的可选包。

Java is an optional package on the latest versions of macOS.

然而,一旦安装,它似乎 JAVA_HOME 环境变量未正确设置

Yet once installed it appears like the JAVA_HOME environment variable is not set properly.

推荐答案

使用已安装Java可选包 Oracle JDK
添加〜/ .bash_profile 文件的以下行之一将相应地设置环境变量。

With the Java optional package or Oracle JDK installed, adding one of the following lines to your ~/.bash_profile file will set the environment variable accordingly.

export JAVA_HOME="$(/usr/libexec/java_home -v 1.6)"
or
export JAVA_HOME="$(/usr/libexec/java_home -v 1.7)"
or
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"

更新:添加 -v 标记基于 Jilles van Gurp 回复

Update: added -v flag based on Jilles van Gurp response.

这篇关于MacOS Mojave(10.14)到Lion(10.7)的JAVA_HOME在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆