Ant build - specifying target Java version

"Jan Tosovsky" <[email protected]>
Newsgroups gmane.text.xml.batik.devel
Message-ID <[email protected]>
Dear All,

I am trying to modify build.xml config to produce bytecode compatible with
JDK 1.7.

So far I tried:

(1) compile on JDK 8 with modifying all <javac> tasks to <javac target="1.7"
...>
(2) compile on JDK 8 with global param <property
name="ant.build.javac.target" value="1.7" />
(3) same as above with older Ant version to avoid possible issue:
https://bz.apache.org/bugzilla/show_bug.cgi?id=59683
(4) compile on JDK 7u80

Nothing helped. Especially the last item is very suspicious. Both JAVA_HOME
and PATH variable points to JDK7, but when testign the produced jars, I am
getting the same error message:

"jdk1.7.0_80\bin\java" -Xmx2G -jar batik-rasterizer-svn-trunk.jar -m
image/png -w 200 -h 200 horologium.svg
Exception in thread "main" java.lang.UnsupportedClassVersionError:
org/apache/batik/apps/rasterizer/Main : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at
sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

Is it possible Ant could somehow bypass my JDK settings and use another JDK
version?

I am stuck now. Windows 10 64-bit + Oracle JDK 7/8.

Thanks,

Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.