3

I have looked all over the system and cannot find where the $JAVA_HOME environmental variable is set. It is not on ~/.bash_profile or ~/.profile, also it is not on the ~/Library/LauncherAgents files, but if I type echo $JAVA_HOME I get:

/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home

So it is defined somewhere, but where? it is driving me crazy.

UPDATE

I was trying to install Maven, and had some problems, but not with the JAVA_HOME env variable, but still I added, just in case, the path to the Java directory to the .bash_profile file:

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/

Then I deleted it. And now whenever I try to print $JAVA_HOME I got nothing, it was like setting the variable in the bash_profile had an overriding effect wherever $JAVA_HOME was, so now everything is "normal". I mean, I need to declare the export statement for the $JAVA_HOME in the .bash_profile again to set Java. But before it didn't work like this, it was getting $JAVA_HOME from somewhere else !!!

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
FraK
  • 919
  • 1
  • 13
  • 21

1 Answers1

0

Find a list of files which include JAVA_HOME from the root directory:

cd /
find . -exec grep -Hn JAVA_HOME {} \;

References

Community
  • 1
  • 1
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265