MCRcortex/nekodetector

Issue compiling

SunderB opened this issue · 2 comments

Hi, I'm trying to compile the .jar file by running ./gradlew build, and I'm getting some errors:

> Task :compileJava FAILED
/home/sunder/program-src/nekodetector/src/main/java/me/cortex/jarscanner/Detector.java:66: error: ')' expected
        if (a instanceof TypeInsnNode aa) {
                                     ^
/home/sunder/program-src/nekodetector/src/main/java/me/cortex/jarscanner/Detector.java:66: error: not a statement
        if (a instanceof TypeInsnNode aa) {
                                      ^
/home/sunder/program-src/nekodetector/src/main/java/me/cortex/jarscanner/Detector.java:66: error: ';' expected
        if (a instanceof TypeInsnNode aa) {
                                        ^
/home/sunder/program-src/nekodetector/src/main/java/me/cortex/jarscanner/Detector.java:69: error: ')' expected
        if (a instanceof MethodInsnNode aa) {
                                       ^
/home/sunder/program-src/nekodetector/src/main/java/me/cortex/jarscanner/Detector.java:69: error: not a statement
        if (a instanceof MethodInsnNode aa) {
                                        ^
/home/sunder/program-src/nekodetector/src/main/java/me/cortex/jarscanner/Detector.java:69: error: ';' expected
        if (a instanceof MethodInsnNode aa) {
                                          ^
/home/sunder/program-src/nekodetector/src/main/java/me/cortex/jarscanner/Detector.java:72: error: ')' expected
        if (a instanceof InsnNode aa) {
                                 ^
/home/sunder/program-src/nekodetector/src/main/java/me/cortex/jarscanner/Detector.java:72: error: not a statement
        if (a instanceof InsnNode aa) {
                                  ^
/home/sunder/program-src/nekodetector/src/main/java/me/cortex/jarscanner/Detector.java:72: error: ';' expected
        if (a instanceof InsnNode aa) {
                                    ^
9 errors

FAILURE: Build failed with an exception.

Is there anything that I'm missing? I'm not too familiar with building Java applications so apologies if there's an obvious fix.
Also if it's relevant, the default java version on my machine is Java 11 (maybe it's an issue with the wrong version?).

that's an issue with the java version, i had that issue too running the snapshot build, just download the newest java version and you'll be fine

That was it! I managed to get it to work by forcing it to use Java 17:
./gradlew build -Dorg.gradle.java.home=/usr/lib/jvm/java-17-openjdk-amd64
Cheers :)