Gradle project failing to build - discrepancy between Java versions

Hi,

Trying to get Gradle to build my project (using Eclipse Neon), but I’ve run into some interesting issues. I did some research and after reading through this thread, i discovered that the results of using gradlew -version in command line and println System.getProperty(“java.home”) in build.gradle produced different results. Specifically, the command line returned Java 1.8, while build.gradle printed Java 1.6. Java 1.6 is the Java version is want to use, though it seems whatever causes this discrepancy also causes the project to fail when building it. It’s also worth noting that while the post I linked was solved by modifying a properties file, my properties file didn’t have any commands to set the Java version, and adding such a command made no difference.

Just a heads up for anyone who finds this- I (sort of) solved my issue by starting a new Gradle project in Eclipse and slowly moving over files. Figured out that Gradle did not like my JUnit test placement (they had to be moved to the file directory it generated), and I also had to add a command in my build.gradle file to point to the proper Java 1.6 executable. Both gradlew -version and println System.getProperty(“java.home”) now say that Gradle is using 1.8, however the built jar was able to run with Java 1.6. So there is still some odd behavior, but I’m going to be glad it works and not question it.