0

I have java installed. However, JAVA_HOME is empty and I can't find out where it should point to:

$ ls /usr/lib/jvm/default-java
ls: cannot access '/usr/lib/jvm/default-java': No such file or directory

$ ls /usr/bin/java
/usr/bin/java
  • [This](http://stackoverflow.com/questions/4681090/how-do-i-find-where-jdk-is-installed-on-my-windows-machine) might help you. On unix based system `which java` should work – PSD May 28 '16 at 10:06
  • you should look for this in linux forums: e.g. [Where can I find the Java SDK in Linux?](http://stackoverflow.com/a/5251365/6287240) – TmTron May 28 '16 at 10:11
  • Please also try : `$ find /usr/ -name "java*"` and `$ find /etc/alternatives/ -name java` – Knud Larsen May 28 '16 at 10:34

1 Answers1

1

Try

which java | xargs -L1 ls -al

it will show you where java is really stored on your hard drive as it must a symbolic link

An example of Output:

/usr/bin/java -> /foo/bar/java

In this case java is in the directory bar

Nicolas Filotto
  • 43,537
  • 11
  • 94
  • 122
  • `which` will work if java is in the PATH (which normally it would be). However java may have been installed in a custom location. Also, Java is often installed peculiarly so you may get `/usr/java/default/bin/java` which is **another** link and not where JAVA_HOME should point. This works for many Linux installations: `find /usr/java -wholename '*ava/jdk*' -prune` – Steven the Easily Amused Sep 30 '16 at 23:21