Angu
Angu

Reputation: 872

Error: JAVA_HOME is not defined correctly ubuntu

i have used this command but not working

export JAVA_HOME=:/usr/bin/java

show error message:

    Error: JAVA_HOME is not defined correctly.
  We cannot execute :/usr/bin/java/bin/java

Upvotes: 0

Views: 3473

Answers (3)

osechet
osechet

Reputation: 466

JAVA_HOME must be set to a directory that contains a bin sub-directory with a java executable in it. In general, it is set to the root directory of a JDK or JRE. If you want to use the "system" java, set JAVA_HOME to /usr (and don't put a colon after the =):

export JAVA_HOME=/usr

Upvotes: 3

Kasra
Kasra

Reputation: 3145

Try this:

export JAVA_HOME=/usr/lib/jvm/java-7-oracle

or

export JAVA_HOME=/usr/java/jdk1.8.0_05

In this one, you need to rename jdk1.8.0_05 depending on the installed path on your system.

Upvotes: 0

Vamsi
Vamsi

Reputation: 878

Normally, you set such paths in ~/.bashrc.

Findout where is java location in your ubuntu machine. For help, check this: Where is the Java SDK folder in my computer? Ubuntu 12.04

after that add export line to your ~/.bashrc file

export JAVA_HOME=....

Upvotes: 0

Related Questions