1
votes

I'm running the following command to try to switch to Java 1.6

$export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)

But am getting the error

-bash: JAVA_HOME=/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home: No such file or directory

Yet the directory in the error message does exist: enter image description here

1
When do you get that error? And does running just the java_home part return what's expected? It looks more like something that's using JAVA_HOME is confused.Dave Newton
It appears in the terminal immediately after running the $export command. What do you mean by running just the java_home part? If I run that command without the $export there's no errorGruntcakes
Ah, ha; there's no $export command. There's an export command. The $ is the default shell prompt. (Well, was; I don't see it much anymore IRL.)Dave Newton

1 Answers

3
votes

You have to leave the preceding dollar-sign off (export instead of $export):

export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)