web-dev-qa-db-ja.com

intellijでJava 11サンプルプログラムを実行できない

public class First {
  public static void main(String[] args) {
    System.out.println("Hello Java 11");
  }
}

上記のプログラムをJava 11 intellijで実行しようとしています。

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

13
shubham12511

Java 11はまだ非常に新しいです。

IntelliJのキャッシュが破損したのではないかと思うので、それらをクリアすると解決するはずです。

このような新しいJDKを使用する場合、Intellijも最新の状態に保ちます。

11
Peter Lawrey

ここで同じエラーが発生し、intellij 2018.1にアップグレードされ、エラーはなくなりました。

4
j.e.