D2RQ is shipped with an ant
build script, which works fine. I can compile on a linux box, where the default ant version is 1.8.2 and the javac version is 1.7.0_121.
I want to compile D2RQ with Java 8. I've downloaded ant 1.10, which requires Java 8 2.
Then I run into some issues:
When I run ant 1.10 without changing the source (or target) option, ant seems to run successfully - even though the default version of java on the system is 1.7 (i.e. <8) - I would have expected it to complain it didn't have a valid version of java?
I've tried modifying the compile
target in the build.xml file from
source="1.5"
target="1.5"
to
source="1.8"
target="1.8"
but I get an error of:
compile:
[javac] Compiling 171 source files to /home/chris/d2rq/bldsrc
[javac] javac: invalid target release: 1.8
I get the same error if I replace '1.8' with just '8', but '1.6' and '1.7' both work.
I then tried a different approach (after a bit more Googling) and replaced
source="1.5"
target="1.5"
with
fork="yes"
executable="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64/jre/bin/java"
the location of java 8 is valid, but running the compile task now results in
compile:
[javac] Compiling 171 source files to /home/chris/d2rq/bldsrc
[javac] Unrecognized option: -d
[javac] Error: Could not create the Java Virtual Machine.
[javac] Error: A fatal exception has occurred. Program will exit.
I don't even know if -d
is a D2RQ compile option or a valid java flag.
Is there anything else I should be trying?!
The executable
attribute of <javac>
must point to the javac
executable, not java
. Note the "c"
at the end of javac
.
The following must be changed to point to javac
:
executable="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64/jre/bin/java"
Where javac
lives depends on your Linux distribution.