BUILD FAILED
java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at org.apache.tools.ant.loader.AntClassLoader2.defineClassFromData(AntCl
assLoader2.java:76)
at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader
.java:1090)
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoa
der.java:1154)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:110
7)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:977
)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:457)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:183)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:
142)
at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.jav
a:91)
at org.apache.tools.ant.Main.runBuild(Main.java:653)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Total time: 1 second
java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at org.apache.tools.ant.loader.AntClassLoader2.defineClassFromData(AntCl
assLoader2.java:76)
at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader
.java:1090)
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoa
der.java:1154)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:110
7)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:977
)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:457)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:183)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:
142)
at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.jav
a:91)
at org.apache.tools.ant.Main.runBuild(Main.java:653)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Bad version number in .class file
C:\document\eclipse\java\Sql2java-2-6-5>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Which versions are you using? It seems to me as an incompatibility between the compiled classes and the JVM. Just take care that your version of ant is compatible with your version of the JVM. It may be that the latest versions of ant could be incompatible with older versions of the JVM. Here are mine:
C:\Documents and Settings\afagot\Mis documentos\workspace\s2j2>ant -version
Apache Ant version 1.7.0 compiled on December 13 2006
C:\Documents and Settings\afagot\Mis documentos\workspace\s2j2>java -version
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode)
Are you compiling the generator itself or the generated code? In the main build file I can't see any task definition, while you stack trace seems to lead to an error intenting to load some external task. If compiling the generated code, you may have to comment out the Tomcat targets and task definitions if you don't have the Tomcat extensions installed (that's old stuff I never tried out).
I hope you will receive a better help in the next days.
Alain.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My JRE version is 1.6.0_03. My Java Hot Spot version is 1.6.0_03-b05. My Ant version is 1.7.0
I got the compile task to run, but I don't know what was wrong. I was running inside Eclipse, and also from the command line. In Eclipse, I did not set the build folder to the same location as it was set in build.xml. When I fixed this, the Ant compile task ran. I am not sure why the Eclipse build folder would have to do with the Ant build folder, but the problem seems fixed.
On the other hand, I cannot get the Ant javadoc task to run, but I can generate the Javadocs from a Windows batch file. Here is the contents of the batch file:
I would appreciate any help. I am trying to compile sql2java with jdk1.5.0_06, but I get the following error:
C:\document\eclipse\java\Sql2java-2-6-5>ant compile
Buildfile: build.xml
BUILD FAILED
java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at org.apache.tools.ant.loader.AntClassLoader2.defineClassFromData(AntCl
assLoader2.java:76)
at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader
.java:1090)
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoa
der.java:1154)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:110
7)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:977
)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:457)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:183)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:
142)
at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.jav
a:91)
at org.apache.tools.ant.Main.runBuild(Main.java:653)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Total time: 1 second
java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at org.apache.tools.ant.loader.AntClassLoader2.defineClassFromData(AntCl
assLoader2.java:76)
at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader
.java:1090)
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoa
der.java:1154)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:110
7)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:977
)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:457)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:183)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:
142)
at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.jav
a:91)
at org.apache.tools.ant.Main.runBuild(Main.java:653)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Bad version number in .class file
C:\document\eclipse\java\Sql2java-2-6-5>
Which versions are you using? It seems to me as an incompatibility between the compiled classes and the JVM. Just take care that your version of ant is compatible with your version of the JVM. It may be that the latest versions of ant could be incompatible with older versions of the JVM. Here are mine:
C:\Documents and Settings\afagot\Mis documentos\workspace\s2j2>ant -version
Apache Ant version 1.7.0 compiled on December 13 2006
C:\Documents and Settings\afagot\Mis documentos\workspace\s2j2>java -version
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode)
Are you compiling the generator itself or the generated code? In the main build file I can't see any task definition, while you stack trace seems to lead to an error intenting to load some external task. If compiling the generated code, you may have to comment out the Tomcat targets and task definitions if you don't have the Tomcat extensions installed (that's old stuff I never tried out).
I hope you will receive a better help in the next days.
Alain.
Thanks for your response.
My JRE version is 1.6.0_03. My Java Hot Spot version is 1.6.0_03-b05. My Ant version is 1.7.0
I got the compile task to run, but I don't know what was wrong. I was running inside Eclipse, and also from the command line. In Eclipse, I did not set the build folder to the same location as it was set in build.xml. When I fixed this, the Ant compile task ran. I am not sure why the Eclipse build folder would have to do with the Ant build folder, but the problem seems fixed.
On the other hand, I cannot get the Ant javadoc task to run, but I can generate the Javadocs from a Windows batch file. Here is the contents of the batch file:
c:\programs\java\jdk1.5.0_06\bin\javadoc -d ../build/javadoc -sourcepath ../src/java -subpackages org.acme.sample
pause
Here is the output from the Ant task:
C:\document\eclipse\java\Sql2java-2-6-5>ant javadoc
Buildfile: build.xml
BUILD FAILED
C:\document\eclipse\java\Sql2java-2-6-5\build.xml:58: java.lang.UnsupportedClass
VersionError: Bad version number in .class file
Total time: 1 second
C:\document\eclipse\java\Sql2java-2-6-5>