How to install a plugin targeting Java 21?

已回答

I need to create a plugin built using Java 21 and running in the latest version of IntelliJ.  This was working for an older version of IntelliJ when my company was using Java 17 (preview).  We just upgrade everything to use Java 21.  This includes using the newest IntelliJ, which is 2024.1.1.  That IntelliJ is using Java runtime 17.

 

Does this mean that it is impossible to install a plugin that targets Java 21 in this version of IntelliJ?

If so, when will IntelliJ support pluings that target Java 21?  When will IntelliJ be using Java 21 runtime?

0

Hi Tyson,

You can't run Java 21 compatible code in JRE 17. If you don't use any Java 21-specific features, you can try compiling it to Java 17, and it should work:

java {
    sourceCompatibility = "17"
    targetCompatibility = "17"
}

Switch to 21 in IntelliJ IDEA will not happen soon (not in 2024.2).

0

请先登录再写评论。