Linux中的JAVA_HOME目录 [英] JAVA_HOME directory in Linux

查看:505
本文介绍了Linux中的JAVA_HOME目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有任何linux命令可以用来找出 JAVA_HOME 目录?我试过打印环境变量(env),但是找不到目录。

Is there any linux command I could use to find out JAVA_HOME directory? I've tried print out the environment variables ("env") but I can't find the directory.

推荐答案

echo $ JAVA_HOME 将打印该值,如果设置。但是,如果您没有在启动脚本中手动设置它,则可能未设置。

echo $JAVA_HOME will print the value if it's set. However, if you didn't set it manually in your startup scripts, it probably isn't set.

如果尝试哪个java 它没有找到任何东西,Java可能不会安装在您的机器上,或至少不在您的路径。根据您拥有的Linux发行版以及是否有根访问权限,您可以访问 http://www.java.com 下载您需要的版本。然后,您可以将JAVA_HOME设置为指向此目录。记住,这只是一个惯例,不应该用来确定是否安装了Java。

If you try which java and it doesn't find anything, Java may not be installed on your machine, or at least isn't in your path. Depending on which Linux distribution you have and whether or not you have root access, you can go to http://www.java.com to download the version you need. Then, you can set JAVA_HOME to point to this directory. Remember, that this is just a convention and shouldn't be used to determine if java is installed or not.

这篇关于Linux中的JAVA_HOME目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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