Do I have to install JDK?

Answered

Hello all,

I'm a Java beginner and want to learn Java and develop my simple application with the IntelliJ IDEA community.

 

My question

Do I have to install OpenJDK from https://openjdk.java.net/ to develop an application with the IntelliJ IDEA community?

 

What I've done

I just installed IntelliJ IDEA community 2019.3.1 and I am following JetBrain documents. I thought that the IntelliJ IDEA community contains a certain JDK.

However, the document(https://www.jetbrains.com/help/idea/sdk.html) I read makes me confused. Here are sentences from the documents:

The bundled JRE is used for running the IDE itself, and it's not sufficient for developing Java applications. 
You must obtain and install the standalone JDK before you start developing in Java.

IntelliJ IDEA doesn't come with the JDK, so if you don't have the necessary JDK version, download and install it.
Note that some frameworks require their own SDKs in addition to the JDK, for example, Android or Grails.

When I created my first project I saw the java version and it seems like jbr folder under the IntelliJ IDEA folder contains OpenJDK.

C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.3.1\jbr\bin>java -version
openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment (build 11.0.5+10-b520.17)
OpenJDK 64-Bit Server VM (build 11.0.5+10-b520.17, mixed mode, sharing)

However, it looks like I have to install OpenJDK to continue to develop a Java application. Do I misunderstand the document?

Thank you,

0
4 comments

Yes, you do need to download and install JDK (the vendor doesn't matter). Future versions of the IDE will provide an option to download and install the JDK automatically (it's work in progress).

See https://www.jetbrains.com/help/idea/creating-running-and-packaging-your-first-java-application.html .

1

Is this answer still correct? I just installed 2019.3.2 on a fresh (Windows10) VM and I can create, build, run and debug a (HelloWorld) Java application without installing any SDK ... 

This page (https://www.jetbrains.com/help/idea/sdk.html) says , just like the previous answer, that a separate SDK has to be downloaded and installed. But if this is true, can you please explain why it 'works' and 'why a separate SDK' is better?

I have a ticket (#2485635) with the same question (Feb 7, 2020).

0

Mattias,

Automatic detection of JBR as JDK will be removed in future releases.

2

Hi Mattias,

I'm also a newbie Java learner, but I'm gonna explain based on my understands of IntelliJ.

Actually, what you are using is not SDK(or JDK). It's a JBR, which is made for running IntelliJ. Since JBR is also based on OnenJDK, your Hello World application was running. But, please remember that JBR is not SDK. The purpose of JBR is not running your application. You need a JDK/SDK for running your application.

Hope this helps you. Thanks!

1

Please sign in to leave a comment.