Java apps not finding JAVA_HOME

Posted by: bluethundr

Java apps not finding JAVA_HOME - 10/25/09 05:30 PM


I can't seem to get any Java based apps to run on my MacBook Pro (10.6 Snow Leopard).

I was not able to get a few java based apache apps to run. First I tried to get hadoop to run, then I tried launching apache tomcat, and then finally I downloaded an ftps app that depended on java and THAT couldn't find what it needed in the current value of JAVA_HOME.

If I can get hadoop/hbase running I think I will have a basis for getting those other Java apps to work. When I run the startup scripts as the hadoop user which I added it seems to look for Java here:

/usr/local/hadoop/bin/../bin/hadoop: line 258: /System/Library/Frameworks/JavaVM.framework/Versions/Current/JavaVM/bin/java: Not a directory

This is the current value of my JAVA_HOME environment variable.

bash-3.2# echo $JAVA_HOME

These are the contents of my java install's Current directory:

drwxr-xr-x   8 root  wheel     272 Sep 12 17:27 .
drwxr-xr-x  12 root  wheel     408 Sep 30 18:46 ..
lrwxr-xr-x   1 root  wheel      28 Sep 12 17:27 CodeResources -> _CodeSignature/CodeResources
drwxr-xr-x  37 root  wheel    1258 Jul 20 19:36 Commands
drwxr-xr-x   4 root  wheel     136 Jul 20 19:28 Frameworks
-rwxr-xr-x   1 root  wheel  191840 Jul 20 19:28 JavaVM
drwxr-xr-x  33 root  wheel    1122 Sep 12 17:27 Resources
drwxr-xr-x   3 root  wheel     102 Jul 20 19:28 _CodeSignature

The problem seems to be that Hadoop is looking for the JVM to be called 'java' in the 'bin' subdir of Current. I have also tried setting the value to 'Current/JavaVM' in which case it looks for 'Current/JavaVM/bin/java'.

But on my Mac the right place for JAVA_HOME seems to be called 'JavaVM' and living on the root of Current. How do I tell hadoop the correct name of my JVM? I have noticed this in all java powered apache apps, and again am just using hadoop here as an example.

I think if I get this hadoop problem solved I'll be able to solve the problem for all my java apps that currently aren't working.
Posted by: bluethundr

Re: Java apps not finding JAVA_HOME - 10/25/09 06:32 PM