Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to run java 11 sample program in intellij

Tags:

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

I am trying to run above program in Java 11 with intellij. But getting below Error.

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

like image 220
shubham12511 Avatar asked Sep 25 '18 14:09

shubham12511


People also ask

How do I change the default Java version in IntelliJ?

In the Project Structure dialog Ctrl+Alt+Shift+S , select SDKs. Select the necessary JDK version if you have several JDKs configured, and open the Documentation Path tab on the right.

How to create first Java program in IntelliJ IDE?

IntelliJ IDEA First Java Program. 1 1. Create Project. Start IntelliJ IDE. Go to File -> New -> Project. The below screen appears. Select The Java Project and appropriate Project SDK. 2 2. Create Package. 3 3. Create Java Class. 4 4. Run Application.

Can I run an IntelliJ program from the editor?

You can run applications right from IntelliJ IDEA if you have an SDK set up for your project / module. If you are not going to pass any parameters to your program, and your program does not require any specific actions to be performed before start, you can run it right from the editor.

How to write and execute Hello World program in IntelliJ?

We are going to write and execute Hello World program. 1. Create Project Start IntelliJ IDE. Go to File -> New -> Project. The below screen appears. Select The Java Project and appropriate Project SDK. Click Next. Now, Type the Project name and select Project location. Click Finish. Once we click on Finish Button, the following screen will open. 2.

How do I run a JAR file in IntelliJ?

Create a run configuration for the packaged application. To run a Java application packaged in a JAR, IntelliJ IDEA allows you to create a dedicated run configuration. Press Ctrl+Shift+A, find and run the Edit Configurations action. In the Run/Debug Configurations dialog, click and select JAR Application. Name the new configuration: HelloWorldJar.


2 Answers

Java 11 is still very new.

I suspect IntelliJ's caches got corrupted and clearing them should help.

I would also keep Intellij up to date if using such a new JDK.

like image 174
Peter Lawrey Avatar answered Sep 28 '22 00:09

Peter Lawrey


Same error here, upgraded to intellij 2018.1 and the error was gone.

like image 22
j.e. Avatar answered Sep 27 '22 23:09

j.e.