Creating a jar for LibGDX game

Hi,

I am having issues with deploying my game to a jar.
I am pasting “gradlew desktop:dist” in the terminal but get some error messages:

:core:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.6
C:\Users\Daniel\Documents\LibGDXProject\DesktopTest\core\src\com\desktoptest\game\DesktopTesst.java:20: error: diamond operator is not supported in -source 1.6
ArrayList test = new ArrayList<>();
^
(use -source 7 or higher to enable diamond operator)
1 error
1 warning
:core:compileJava FAILED

It seems the compiler wants to use java 1.6 for deploying even though it uses 1.7 when I just compile it in intellij without problem.
I looked everwhere in the settings to find some setting still set to 1.6, but could not find anything.
No luck finding a solution online either.

I’ve seen this sort of thing before, in the same directory as the gradlew file there’s a [icode]settings.gradle[/icode] and two [icode]build.gradle[/icode].
Make sure to get us the [/icode]build.gradle[/icode] in both the root directory (same as gradlew) and the core folder.

In build.gradle, add this:

allprojects {
    // ... other lines
    sourceCompatibility = 1.7
}

I think gradle uses JAVA_HOME Jdk by default. Try “java -version” on the command line and make sure that you don’t get 1.6 java version.

Thanks guys!
I changed the version in the build.gradle files and it works now.