美文网首页
jdk环境冲突解决笔记

jdk环境冲突解决笔记

作者: 紫鹰 | 来源:发表于2021-08-23 14:55 被阅读0次

    刚下载了idea,加载一个项目运行Java项目的时候报错如下

    Abnormal build process termination:
    /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/bin/java -Xmx700m -Djava.awt.headless=true -Djava.endorsed.dirs="" -Dexternal.project.config=/Users/vhawk/Library/Caches/JetBrains/IntelliJIdea2021.2/external_build_system/base-display-service.1a7ce55f -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Djdt.compiler.useSingleThread=true -Daether.connector.resumeDownloads=false -Dio.netty.initialSeedUniquifier=-8371877724096475844 -Dfile.encoding=UTF-8 -Duser.language=zh -Duser.country=CN -Didea.paths.selector=IntelliJIdea2021.2 "-Didea.home.path=/Applications/IntelliJ IDEA.app/Contents" "-Didea.config.path=/Users/vhawk/Library/Application Support/JetBrains/IntelliJIdea2021.2" "-Didea.plugins.path=/Users/vhawk/Library/Application Support/JetBrains/IntelliJIdea2021.2/plugins" -Djps.log.dir=/Users/vhawk/Library/Logs/JetBrains/IntelliJIdea2021.2/build-log "-Djps.fallback.jdk.home=/Applications/IntelliJ IDEA.app/Contents/jbr/Contents/Home" -Djps.fallback.jdk.version=11.0.11 -Dio.netty.noUnsafe=true -Djava.io.tmpdir=/Users/vhawk/Library/Caches/JetBrains/IntelliJIdea2021.2/compile-server/base-display-service_34da5f75/temp -Djps.backward.ref.index.builder=true -Djps.track.ap.dependencies=false --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -Dtmh.instrument.annotations=true -Dtmh.generate.line.numbers=true -Dkotlin.incremental.compilation=true -Dkotlin.incremental.compilation.js=true -Dkotlin.daemon.enabled -Dkotlin.daemon.client.alive.path="/var/folders/3m/mv8m0x1n7cb0z_x0bnh2f6y80000gn/T/kotlin-idea-5364423136393374627-is-running" -classpath "/Applications/IntelliJ IDEA.app/Contents/plugins/java/lib/jps-launcher.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/lib/tools.jar" org.jetbrains.jps.cmdline.Launcher "/Applications/IntelliJ IDEA.app/Contents/lib/protobuf-java-3.15.8.jar:/Applications/IntelliJ IDEA.app/Contents/lib/3rd-party.jar:/Applications/IntelliJ IDEA.app/Contents/lib/slf4j.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jna.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/java/lib/maven-resolver-connector-basic-1.3.3.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/java/lib/jps-javac-extension-1.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/java/lib/jps-builders.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/java/lib/jps-builders-6.jar:/Applications/IntelliJ IDE

    网上查这个问题,大家说重新装一下jdk就可以
    然后就使用Java --version 查看了一下我的版本信息,居然是Java11,我明明安装的有Java8,于是决定卸载Java11

    我的笔记本是Mac,卸载过程如下

    使用命令查看安装位置及版本信息

    /usr/libexec/java_home -V
    

    输出信息为

    11.0.12.1, x86_64:  "Amazon Corretto 11"    /xxx/Library/Java/JavaVirtualMachines/corretto-11.0.12/Contents/Home
    1.8.0_261, x86_64:  "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home
    1.8.0_171, x86_64:  "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
    

    没错,我就是脑子一抽,装了两个Java8

    使用如下命令卸载

    sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home    
    

    卸载Jdk,只剩下1.8.0_261这一个,重新运行依然抱错,于是重启电脑,打开idea,就可以正常运行了。问题完美解决

    相关文章

      网友评论

          本文标题:jdk环境冲突解决笔记

          本文链接:https://www.haomeiwen.com/subject/lpkliltx.html