problem in ant build invalid target release

前端 未结 5 1942
执念已碎
执念已碎 2021-01-17 10:41

problem in ant build

[javac] Compiling 86 source files to F:\\XXX\\classes
    [javac] javac: invalid target release: 1.6
    [javac] Usage: javac 

        
5条回答
  •  感动是毒
    2021-01-17 11:43

    Yes, this is an old one, but came across at work and could not find a solution documented anywhere yet...

    Even though I too came across this using Ant, it in fact does not seem to have anything to do with Ant - there seem to have been some broken JDK builds out there:

    C:\>%JAVA_HOME%\bin\javac -version
    javac 1.6.0_21
    javac: no source files
    Usage: javac  
    ...
    
    C:\>%JAVA_HOME%\bin\javac -target 1.6
    javac: invalid target release: 1.6
    Usage: javac  
    ...
    

    Where as another 1.6 build looks like:

    C:\>set JAVA_HOME=C:\Progra~1\Java\jdk1.6.0_45
    
    C:\>%JAVA_HOME%\bin\javac -version
    javac 1.6.0_45
    
    C:\>%JAVA_HOME%\bin\javac -target 1.6
    javac: no source files
    Usage: javac  
    use -help for a list of possible options
    

    So the solution is to upgrade JDK.

提交回复
热议问题