简体   繁体   中英

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. Say, my JAVA_HOME when using: echo $JAVA_HOME is: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

and my java installation when using: which java is: /usr/bin/java

What change should I make to set JAVA_HOME as the java root?

Thanks!

And for a follow up, I think the tutorial mentioned to make the change inside the conf/en-sh part. 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

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 . Here is the complete tutorial.

On my system, I have JAVA_HOME set to /Library/Java/Home on Mountain Lion. Fair enough... add export JAVA_HOME=/Library/Java/Home line to the .bash_profile, .zshrc file in your home directory. If you're using tcsh, the line you want is setenv JAVA_HOME /Library/Java/Home . The default shell on recent versions of OS X for users in bash. You can find out what you're using using echo $SHELL .

Set you JAVA_HOME to /System/Library/Java/JavaVirtualMachines/1.6.0.jdk. That's enough.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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