0

I have jdk installed under "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java"

When i do a "which java", it returns "/usr/bin/java"

But, I want which java to return /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java, instead of /usr/java/bin

How can this be done? and what is happening behind the scenes?

ufdeveloper
  • 387
  • 6
  • 19

2 Answers2

0

It may be that /usr/bin/java is a symbolic link.

Try

ls -l `which java`

This will run an ls -l on the output of 'which java', hopefully giving you the full path pointed to by the link.

Adam F
  • 11
  • 2
0

/usr/bin/java is a symlink:

/usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

If you use:

/usr/libexec/java_home -v

You can confirm whether or not it's using 1.6.0:

/Library/Java/JavaVirtualMachines/jdk1.6.0.jdk/Contents/Home
l'L'l
  • 44,951
  • 10
  • 95
  • 146