2

Before I compiled my code on Windows using eclipse ant and java 1.8 and it was fully working.

Now I am using compiling on Linux. I made sure to download jdk 1.8 and ant.

javac -version
javac 1.8.0_91

java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

ant -v
Apache Ant version 1.7.1 compiled on April 26 2010

However, when I run ant to launch my build.xml, it is still failing from what seems to be wrong javac. Is there something else I need to set?

 ant
Buildfile: build.xml

compileBuildDir:
    [javac] Compiling 12 source files to /build
    [javac] Model.java:19: cannot access DBObject
    [javac] bad class file: Utilities.jar(DBObject.class)]
    [javac] class file has wrong version 52.0, should be 50.0
    [javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
    [javac] import DBObject;
    [javac]                     

BUILD FAILED
/build.xml:173: Compile failed; see the compiler error output for details.

When I do a ant -v

ant -v
Apache Ant version 1.7.1 compiled on April 26 2010
Buildfile: build.xml
Detected Java version: 1.6 in: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre
Detected OS: Linux
parsing buildfile /build.xml with URI = file:/test/build.xml
Project base dir set to: /myProject
[antlib:org.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.
Build sequence for target(s) `packageApplication' is [compileBuildDir, packageApplication]
Complete build sequence is [compileBuildDir, packageApplication, reports, cleanTmpDir, copyToTmp, copyToTmpplot, ]
help
  • 809
  • 5
  • 18
  • 35

1 Answers1

1

Detected Java version: 1.6 in: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre

This is your answer - your path setup is not correct.

Look at this here:

Class file has wrong version 52.0, should be 50.0

Snorik
  • 201
  • 3
  • 15