brown-uk / dict_uk

Project to generate POS tag dictionary for Ukrainian language
GNU General Public License v3.0
559 stars 73 forks source link

./gradlew expand fails on Mac Catalina 10.15.7 (19H2) #287

Closed BarnabasSzabolcs closed 2 years ago

BarnabasSzabolcs commented 2 years ago
> Task :autogen FAILED
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/dict_uk/tools/Autogen has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
arysin commented 2 years ago

Hey, I wonder if you have different versions of Java or it was updated recently? You can try to do ./gradlew clean first and/or maybe ./gradlew --stop (to restart gradle daemon if it's up)

BarnabasSzabolcs commented 2 years ago

Hey Arysin, thanks for the quick answer!

If I type java -version then it returns

java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

I've tried ./gradlew clean && ./gradlew expand with the same error. It must be some java version incompatibility.

Can you please tell me what version should I install? (I also have Homebrew so brew install something would work me pretty good, too.)

arysin commented 2 years ago

Hey, you can try to install JDK11, technically jdk 8 reached end of life a year ago. It looks like Autogen class was compiled by jdk 11 for some reason and current java 8 fails to parse it. You can also try to delete .gradle/ and build/ folders manually. P.S. oh, I just realized I set java version 11 in the gadle so that's the best path to go

BarnabasSzabolcs commented 2 years ago

Hey, thanks for the advice!

It seems the following has to be done for mac:

brew install java11
JAVA_HOME=
./gradlew expand

and this gets to BUILD SUCCESSFUL message.