Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PZ Version 41.71 compilation issues due to pz files having been compiled by a more recent version of Java #82

Open
Alpiyidir opened this issue Jun 5, 2022 · 3 comments

Comments

@Alpiyidir
Copy link

Alpiyidir commented Jun 5, 2022

Won't work, if I try to run it with jdk 17 different errors pop up.

Exception in thread "main" java.lang.UnsupportedClassVersionError: zombie/core/Core has been compiled by a more recent version of the Java Runtime (class file version 61.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:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:284)
at io.cocolabs.pz.zdoc.util.Utils.getClassForName(Utils.java:101)
at io.cocolabs.pz.zdoc.Main.main(Main.java:99)

Execution failed for task ':zomboidVersion'.

Process 'command 'C:\Users\Solak.gradle\jdks\jdk8u332-b09\bin\java.exe'' finished with non-zero exit value 1

@Alpiyidir
Copy link
Author

Alpiyidir commented Jun 7, 2022

07/06/22 (for version 41.71, using IntelliJ IDEA)

I'll post my solution here incase it helps anybody with the same issue:

  1. Making sure gradle doesn't fail to build as the original link used here no longer works
    Edit line 5 in distribution.gradle to
    apply from: 'https://gist.githubusercontent.com/matshou/540f0c59633cd0f857a74848be7ccfc3/raw/changelog.gradle'
    (You can also remove line 4 and 5 to exclude using changelog.gradle but changing it to this link will make the program run as intended)

  2. Changing the gradle version to be compatible with JDK 17
    Go to gradle/wrapper and open gradle-wrapper.properties
    Set the distributionUrl to https://services.gradle.org/distributions/gradle-7.4.2-all.zip

  3. Changing the Gradle JVM to version 17 (Any version >17 should work)
    Go to File/Settings on the IntelliJ settings.
    Navigate to Build, Execution, Deployment/Build Tools/Gradle
    Set "Gradle JVM" to JDK 17

  4. Setting project SDK to version 17
    Go to File/Project Structure/Project
    Set "Project SDK" to the same version as your Gradle JDK

Now you should be able to run the code and use anything you need, it will take a second to start as it will first download a newer version of gradle.

@Alpiyidir Alpiyidir changed the title Can't use with pz version 41.71 PZ Version 41.71 compilation issues due to pz files being compiled with a more recent version of Java Jun 7, 2022
@Alpiyidir Alpiyidir changed the title PZ Version 41.71 compilation issues due to pz files being compiled with a more recent version of Java PZ Version 41.71 compilation issues due to pz files having been compiled with a more recent version of Java Jun 7, 2022
@Alpiyidir Alpiyidir changed the title PZ Version 41.71 compilation issues due to pz files having been compiled with a more recent version of Java PZ Version 41.71 compilation issues due to pz files having been compiled by a more recent version of Java Jun 7, 2022
@jerohero
Copy link

07/06/22 (for version 41.71, using IntelliJ IDEA)

I'll post my solution here incase it helps anybody with the same issue:

  1. Making sure gradle doesn't fail to build as the original link used here no longer works
    Edit line 5 in distribution.gradle to
    apply from: 'https://gist.githubusercontent.com/matshou/540f0c59633cd0f857a74848be7ccfc3/raw/changelog.gradle'
    (You can also remove line 4 and 5 to exclude using changelog.gradle but changing it to this link will make the program run as intended)
  2. Changing the gradle version to be compatible with JDK 17
    Go to gradle/wrapper and open gradle-wrapper.properties
    Set the distributionUrl to https://services.gradle.org/distributions/gradle-7.4.2-all.zip
  3. Changing the Gradle JVM to version 17 (Any version >17 should work)
    Go to File/Settings on the IntelliJ settings.
    Navigate to Build, Execution, Deployment/Build Tools/Gradle
    Set "Gradle JVM" to JDK 17
  4. Setting project SDK to version 17
    Go to File/Project Structure/Project
    Set "Project SDK" to the same version as your Gradle JDK

Now you should be able to run the code and use anything you need, it will take a second to start as it will first download a newer version of gradle.

Also change

toolchain {
  languageVersion = JavaLanguageVersion.of(8)
}

to

toolchain {
  languageVersion = JavaLanguageVersion.of(17)
}

In build.gradle and zdoc.gradle to avoid issues during setupWorkspace

@AlecSanderB
Copy link

07/06/22 (for version 41.71, using IntelliJ IDEA)
I'll post my solution here incase it helps anybody with the same issue:

  1. Making sure gradle doesn't fail to build as the original link used here no longer works
    Edit line 5 in distribution.gradle to
    apply from: 'https://gist.githubusercontent.com/matshou/540f0c59633cd0f857a74848be7ccfc3/raw/changelog.gradle'
    (You can also remove line 4 and 5 to exclude using changelog.gradle but changing it to this link will make the program run as intended)
  2. Changing the gradle version to be compatible with JDK 17
    Go to gradle/wrapper and open gradle-wrapper.properties
    Set the distributionUrl to https://services.gradle.org/distributions/gradle-7.4.2-all.zip
  3. Changing the Gradle JVM to version 17 (Any version >17 should work)
    Go to File/Settings on the IntelliJ settings.
    Navigate to Build, Execution, Deployment/Build Tools/Gradle
    Set "Gradle JVM" to JDK 17
  4. Setting project SDK to version 17
    Go to File/Project Structure/Project
    Set "Project SDK" to the same version as your Gradle JDK

Now you should be able to run the code and use anything you need, it will take a second to start as it will first download a newer version of gradle.

Also change

toolchain {
  languageVersion = JavaLanguageVersion.of(8)
}

to

toolchain {
  languageVersion = JavaLanguageVersion.of(17)
}

In build.gradle and zdoc.gradle to avoid issues during setupWorkspace

And change
it.javaLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(10) }
to
it.javaLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(17) }
in zomboid.gradle

Also, if it complains about a missing mod version, add the line "modversion=0.1.1" in mod.info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants