无法在 intellij 中运行 java 11 示例程序

2022-09-02 04:03:03
public class First {
  public static void main(String[] args) {
    System.out.println("Hello Java 11");
  }
}

我正在尝试使用intellij在Java 11中运行上述程序。但低于错误。

Information:javac 11 was used to compile java sources
Information:Internal caches are corrupted or have outdated format, forcing project rebuild: Module 'eleven-lab' production: java.net.MalformedURLException: unknown protocol: jrt
Information:25/09/18, 6:58 PM - Compilation completed with 1 error and 0 warnings in 4s 516ms
Error:Internal error: (java.net.MalformedURLException) unknown protocol: jrt
java.net.MalformedURLException: unknown protocol: jrt
    at java.net.URL.<init>(URL.java:421)
    at java.net.URL.<init>(URL.java:310)
    at java.net.URL.<init>(URL.java:333)
    at com.intellij.compiler.instrumentation.InstrumentationClassFinder.createJDKPlatformUrl(InstrumentationClassFinder.java:61)
    at org.jetbrains.jps.incremental.instrumentation.ClassProcessingBuilder.createInstrumentationClassFinder(ClassProcessingBuilder.java:125)
    at org.jetbrains.jps.incremental.instrumentation.ClassProcessingBuilder.build(ClassProcessingBuilder.java:93)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1246)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:923)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:995)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:886)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:719)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:371)
    at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178)
    at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
    at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:308)
    at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:138)
    at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:235)
    at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Please perform full project rebuild (Build | Rebuild Project)

java: openjdk-11+28_osx-x64_bin.tar.gz

os: macOS 10.13.2

intellij: ideaIC-2018.2.4


答案 1

Java 11仍然很新。

我怀疑IntelliJ的缓存已损坏,清除它们应该会有所帮助。

如果使用这样的新JDK,我也会让Intellij保持最新状态。


答案 2

此处出现相同的错误,已升级到 intellij 2018.1,错误已消失。


推荐