8

This is driving me nuts.
When running any ant command (even ant -version), I always get the following error on Mac OSX:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/tools/ant/launch/Launcher : Unsupported major.minor version 52.0

I removed and re-installed ant entirely, and still get the same error.

enter image description here

For our company we have to run Java7 to run the command, so I created an alias.

This used to work, I'm not sure what changed.

html_programmer
  • 18,126
  • 18
  • 85
  • 158
  • Did you change the jre in the build configuration window? If i'm not wrong 52 is java 7 – tec Mar 15 '18 at 15:33
  • 1
    @tomyforever Actually 52 is java8. I switch to Java7 runtime with the alias, which is 51. – html_programmer Mar 15 '18 at 15:37
  • Possible duplicate of [How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version](https://stackoverflow.com/questions/10382929/how-to-fix-java-lang-unsupportedclassversionerror-unsupported-major-minor-versi) – CAustin Mar 15 '18 at 16:40

2 Answers2

18

I see you have java 1.7 installed and post that you have installed Ant 1.10.

Ant 1.10 requires jdk 8 Refer : http://ant.apache.org/

The Apache Ant team currently maintains two lines of development. The 1.9.x releases require Java5 at runtime and 1.10.x requires Java8 at runtime. Both lines are based off of Ant 1.9.7 and the 1.9.x releases are mostly bug fix releases while additional new features are developed for 1.10.x. We recommend using 1.10.x unless you are required to use versions of Java prior to Java8 during the build process.

Try using Ant 1.9.x if you can't use java 8

saurabh14292
  • 1,281
  • 2
  • 10
  • 12
0

Here is a list of minimum java version for given ant version enter image description here

Rogol
  • 663
  • 6
  • 7