简体   繁体   English

将JAVA_HOME设置为Java安装的根目录

[英]Set JAVA_HOME to be the root of java installation

I'm currently using hadoop and in the config part there's "define JAVA_HOME at least to be the root of your java installation" I'm actually confused about it. 我目前正在使用hadoop,并且在配置部分中,“至少将JAVA_HOME定义为Java安装的根目录”,我对此确实感到困惑。 Say, my JAVA_HOME when using: echo $JAVA_HOME is: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home 说,我的JAVA_HOME使用时: echo $JAVA_HOME是: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

and my java installation when using: which java is: /usr/bin/java 和我在使用时的Java安装:哪个Java是: /usr/bin/java

What change should I make to set JAVA_HOME as the java root? 要将JAVA_HOME设置为java根,应该进行哪些更改?

Thanks! 谢谢!

And for a follow up, I think the tutorial mentioned to make the change inside the conf/en-sh part. 作为后续,我认为所提到的教程可以在conf / en-sh部分进行更改。 I tried the combinations of the below answers proposed, but still got the error of 1. invalid identifier for the export JAVA_HOME = .. part 2. unable to load hadoop library 我尝试了以下建议的答案的组合,但仍然收到错误1.导出JAVA_HOME = ..部分的无效标识符。2.无法加载hadoop库

Please help..... Any suggestion? 请帮忙.....有什么建议吗?

For GNU/Linux operation system users: in your bash profile set your Java Home variable export JAVA_HOME=/usr/bin/java then export PATH=$PATH:/usr/bin/java . 对于GNU / Linux操作系统用户:在bash配置文件中,设置Java Home变量export JAVA_HOME=/usr/bin/java然后export PATH=$PATH:/usr/bin/java Here is the complete tutorial. 是完整的教程。

On my system, I have JAVA_HOME set to /Library/Java/Home on Mountain Lion. 在我的系统上,我在Mountain Lion上将JAVA_HOME设置为/Library/Java/Home Fair enough... add export JAVA_HOME=/Library/Java/Home line to the .bash_profile, .zshrc file in your home directory. 相当公平...将export JAVA_HOME=/Library/Java/Home行添加到主目录中的.bash_profile和.zshrc文件中。 If you're using tcsh, the line you want is setenv JAVA_HOME /Library/Java/Home . 如果使用的是tcsh,则所需的行是setenv JAVA_HOME /Library/Java/Home The default shell on recent versions of OS X for users in bash. bash中用户的最新版本OS X的默认外壳程序。 You can find out what you're using using echo $SHELL . 您可以使用echo $SHELL找出正在使用的内容。

Set you JAVA_HOME to /System/Library/Java/JavaVirtualMachines/1.6.0.jdk. 将您的JAVA_HOME设置为/System/Library/Java/JavaVirtualMachines/1.6.0.jdk。 That's enough. 够了

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

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