Search code examples
javalinuxenvironment-variablesmahout

Removing trailing bin/java at end of environmental variable in linux


I am trying to compile mahout, I have temporarily changed the JAVA_HOME variable like this:

export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/

and I checked that it was changed correctly using this command:

printenv |grep JAVA_HOME

which returns:

JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64

But when I run mahout mvn clean install -DskipTests=true I run into this error:

Error: JAVA_HOME is not defined correctly. We cannot execute /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/bin/java

I am not sure how this bin/java has shown up. The questions that seem similar to mine with the trailing bin/java don't seem to be quite the same as mine or don't make sense because the answer is just to remove it but I never had it in my path in the first place.

How can I solve this bin/java issue? Thanks in advance.


Solution

  • Answering this in case others run into the same problem. If this post becomes old make sure you have the correct java file name version in the name!

    export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.35.x86_64/

    I had the wrong name for the java path it should be:

    java-1.6.0-openjdk-1.6.0.35.x86_64/ NOT java-1.6.0-openjdk-1.6.0.33.x86_64

    35 NOT 33