Ant is using wrong java version

前端 未结 16 1509
小蘑菇
小蘑菇 2020-11-28 09:20

I\'m using Ant 1.7.0 and installed java 1.6 which is in JAVA_HOME.

I want to build a project using java 1.5, so I\'ve exported JAVA_HOME to be my java 1.5 directory.

16条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 10:00

    This is rather an old question, but I will add my notes for future references.

    I had a similar issue and fixed it by changing the order of the exports in the PATH variable.

    For example I was using a method of concatenating strings to my PATH by doing (this is just an example):

    $> export PATH='$PATH:'$JAVA_HOME
    

    If my variable PATH already had a java in it, the last value would be meaningless, thus the order would matter. To solve this I started inverting it by adding my variable first, then adding the PATH.

    Following this idea I inverted the order that ANT_HOME was being exported. Adding JAVA_HOME before ANT_HOME.

    This could be just a coincidence, but it worked for me.

提交回复
热议问题