JAVA_HOME error

Share on FacebookTweet about this on TwitterPin on PinterestShare on LinkedInShare on Google+Share on RedditShare on TumblrEmail this to someone

When I try to use or compile Nutch, Solr, Hbase. I always met JAVA_HOME error. The error means that JAVA_HOME is set a wrong path or not set any path, then executable file or compiler can’t find JRE or JDK.

 

Check and set JAVA_HOME

For checking the current value.

 

For setting the value, you have to verify JAVA JRE/JDK is installed already. Usually, it’s installed uber /usr/lib/jvm on Debian or Ubuntu. If you can’t find them you need to download from Oracle Java and install.

Which do I install JRE and JDK? You just use Nutch or Solr, you can install only JRE. But when you need to compile Nutch2, it requires JDK. And JDK comes with JRE, it may be a better option installing JDK.

You installed Java Platform JDK, I thought that JAVA_HOME is configured by the installer, but just in case, check by echo command. If it’s not set you can set along below step.

JDK or JRE has been installed below.
/usr/lib/jvm/java-7-oracle

 

There is three way to set JAVA_HOME

A. If you want set an initial path for a user, you can edit “/etc/profile”.
B. If you want set the path of specific user, you can edit “/home/<UserName>/.bashrc”
C. If you want set the path of root, you can edit “/root/.bashrc”

Each file has if scripts like below, you can add few lines.

If you edit “/etc/profile”, you can load the environment variable by below command.

Verify JAVA_HOME again.

Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *