gpt4 book ai didi

java - 无法找到方法 sun.misc.Unsafe.defineClass

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:23:46 28 4
gpt4 key购买 nike

我正在使用 jdk-10.0.2gradle 4.7,在构建我的项目时出现此错误。

    Unable to find method 'sun.misc.Unsafe.defineClass(Ljava/lang/String;[BIILjava/lang/ClassLoader;Ljava/security/ProtectionDomain;)Ljava/lang/Class;'.

Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)

The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)

Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

最佳答案

我有同样的问题(但使用 JDK 11):

Unable to find method 'sun.misc.Unsafe.defineClass(Ljava/lang/String;[BIILjava/lang/ClassLoader;Ljava/security/ProtectionDomain;)Ljava/lang/Class;'.

与你一样使用 gradle 4.7 版本。

我的 gradle-wrapper.properties 文件是:

    distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip

为了解决这个问题,我使用参数 distributionUrl 更改为 4.9 版本的包装器:

 distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip

并在没有任何错误的情况下重建项目。

关于java - 无法找到方法 sun.misc.Unsafe.defineClass,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55918972/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com