如何在 Ubuntu 中设置 Java 环境路径

2022-01-15 00:00:00 environment-variables ubuntu java

我刚刚在 Ubuntu 中使用 sudo apt-get install openjdk-6-jdk 命令安装了 JDK,安装后Java bin 目录在哪里?以及如何设置该目录的环境路径?我对 Ubuntu 没有什么经验,谁能给点建议或推荐任何好的网站以供参考?

I just installed JDK in Ubuntu with sudo apt-get install openjdk-6-jdk command, after the installation where's the Java bin directory located? And how can I set the environment path for that directory? I have little experience with Ubuntu, can anyone give some advice or suggest any good website for reference?

推荐答案

设置环境变量如下

编辑系统路径文件/etc/profile

Edit the system Path file /etc/profile

sudo gedit /etc/profile

在末尾添加以下行

JAVA_HOME=/usr/lib/jvm/jdk1.7.0
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH

然后注销并登录 ubuntu 以设置路径...

Then Log out and Log in ubuntu for setting up the paths...

相关文章