如何在/etc/environment中正确设置JAVA_HOME [英] How to properly set JAVA_HOME in /etc/environment

查看:671
本文介绍了如何在/etc/environment中正确设置JAVA_HOME的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在系统范围内添加JAVA_HOME,还将JAVA_HOME/bin添加到PATH(Ubuntu 12.04).如果我在/etc/environment的末尾添加以下两行,则以后将无法登录.如果我将2行添加到/etc/profile,则一切正常.问题出在哪里?

I am trying to add JAVA_HOME system-wide and also add JAVA_HOME/bin to PATH (Ubuntu 12.04). If I add the following 2 lines at the end of /etc/environment, I cannot login anymore afterwards. If I add the 2 lines to /etc/profile everything works. Wheres the problem?

export JAVA_HOME="/usr/lib/jvm/java-7-oracle"
export PATH="$PATH:$JAVA_HOME/bin"

/etc/environment(第1行)中已经存在以下行:

There is already the following line in /etc/environment (line 1):

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

推荐答案

只需编写

JAVA_HOME="/usr/lib/jvm/java-7-oracle"

/etc/environment上,没有导出"

on your /etc/environment, without the "export"

这篇关于如何在/etc/environment中正确设置JAVA_HOME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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