0

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
Dawson Loudon
  • 6,029
  • 2
  • 27
  • 31
Angu
  • 862
  • 2
  • 13
  • 32

3 Answers3

3

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
osechet
  • 426
  • 3
  • 11
0

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.

Kasra
  • 3,045
  • 3
  • 17
  • 34
  • $ ant debug $ use this command show again error Error: JAVA_HOME is not defined correctly. We cannot execute :/usr/bin/java – Angu Feb 20 '15 at 06:12
  • I just added two more possible options. You need to go to your usr folder, see if there is a java folder, if so, if inside that folder there is a jdk folder, then use the third one. – Kasra Feb 20 '15 at 06:14
0

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=....
Community
  • 1
  • 1
Vamsi
  • 878
  • 1
  • 8
  • 25
  • how to open my ~/.bashrc file? – Angu Feb 20 '15 at 06:14
  • bash: export: `/usr/bin/X11/java': not a valid identifier bash: export: `/usr/share/java': not a valid identifier bash: export: `/usr/share/man/man1/java.1.gz': not a valid identifier – Angu Feb 20 '15 at 06:16
  • `~` points to your home directory which can be something like `/home/angu`. So the bashrc path will be `/home/angu/.bashrc` – Vamsi Feb 20 '15 at 06:17
  • From the link I provided, check where is your Java installation path. Also verify if java is properly installed with command `java -version`. If not, re-install java. – Vamsi Feb 20 '15 at 06:26