ant error JAVA_HOME does not point to SDK

后端 未结 1 791
误落风尘
误落风尘 2021-01-16 09:40

I am trying to install SOLR and running \"ant example\" The build gets pretty far but then gives an error:

/root/apache-solr-3.2.0/solr/common-build.xml:250:         


        
相关标签:
1条回答
  • 2021-01-16 10:22

    OK, I was able to solve the problem I was having. I had set JAVA_HOME, but not as a system environment variable.

    Basically, ant was spawning a new process and wasn't picking up any of the shell variables I had set. So while my current shell could see $JAVA_HOME, when ant was running it could not. It was Brian Kelly's helpful comment on the question of:

    What does java.home show if you run: ant -diagnostics | grep java.home
    

    This showed the location ant was looking for java by default, and proved that my variable wasn't being picked up.

    The machine I was connected to was running bash, so I had to put the lines below into .bash_profile:

    JAVA_HOME=/usr/java/jdk1.6.0_18
    export JAVA_HOME
    

    After this, it ran without a hitch.

    Hope this helps someone.

    0 讨论(0)
提交回复
热议问题