{"slug": "java-27-in-intellij-idea", "title": "Java 27 in IntelliJ IDEA", "summary": "Java 27 was released on September 15, 2026, delivering nine JEPs, four of them final, with four preview features continuing to mature and one JEP remaining an incubator feature, according to JetBrains. IntelliJ IDEA supports Java 27 from day one, letting developers set the language level to \"27 – No new language features\" or \"27 (Preview) – Primitive types in patterns, instanceof, and switch (5th preview)\" and download JDK 27 directly from the IDE. Among the stable features, JEP 523 makes the Garbage-First (G1) garbage collector the default for the HotSpot JVM in all environments, replacing the Serial collector on machines with one CPU or less than 1,792 MB of RAM.", "body_md": "## IntelliJ IDEA\n\nIntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin\n\n[Java](https://blog.jetbrains.com/idea/category/java/)\n\n[News](https://blog.jetbrains.com/idea/category/news/)\n\n# Java 27 in IntelliJ IDEA\n\nIn line with the six-month release cadence, Java 27 was released on September 15, 2026. In this blog post, we will look at what’s included in this release, how IntelliJ IDEA continues to support the latest Java versions, and even how IntelliJ IDEA is benefiting from some of the changes to the JDK.\n\nJava 27 delivers nine JEPs, four of which are final. In addition, four preview features continue to mature and one JEP continues as an incubator feature.\n\nEven if you’re not using IntelliJ IDEA, you can still get its intelligence elsewhere: [*IntelliJ IDEA Goes LSP: Java and Kotlin Intelligence Comes to VS Code, Cursor, and Agentic Flows*](https://blog.jetbrains.com/idea/2026/08/intellij-idea-goes-lsp/). This provides the same level of support for the latest Java versions and features, including early access versions and preview features.\n\nFor this blog post, let’s start by setting up IntelliJ IDEA to use the latest Java version.\n\n# Using Java 27 in IntelliJ IDEA (setup)\n\nFirst, you will need to download JDK 27. There are several ways to do so; you can download it from inside IntelliJ IDEA, using tools like [SDKMAN!](https://sdkman.io/) or [asdf](https://asdf-vm.com/), or install it yourself.\n\n## Downloading the JDK\n\nTo download JDK 27 from IntelliJ IDEA, open the *Project Structure,* go to the tab *Project Settings | Project*, open the drop-down menu in the *SDK* field, and select *Download JDK*. In the *Download JDK* popup that opens, set *Version* to *27*, and in the *Vendor* field, select the vendor you want to use.\n\nIf you have already installed the JDK, you can point IntelliJ IDEA to your installation. Instead, select *Add JDK from Disk* from the drop-down menu.\n\nThe JDK version will be automatically propagated from your project settings to the terminal, which means that both you and your agent can use the right JDK for your project on the terminal in IntelliJ IDEA. A demo of this feature was shown in the [What’s New in IntelliJ IDEA 2026.2](https://youtu.be/1wzW-gM9OZE?si=6xpVuzD2xdXifvef&t=555) video.\n\nIf you use [SDKMAN!](https://sdkman.io/) or [asdf](https://asdf-vm.com/) to manage your JDKs, IntelliJ IDEA can read the `.sdkmanrc` or `.tool-versions` file in your project and can configure the JDK automatically if you already have it installed.\n\nIf you’re using SDKMAN! and the JDK version specified in the `.sdkmanrc` file is not yet installed, an inlay hint will appear in the file, allowing you to download it directly from the IDE by running the relevant SDKMAN! command. This even works if you don’t have SDKMAN! installed, which means this functionality is also available for Windows users.\n\nFor more information on how to set up the JDK, see the [documentation](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk).\n\n## Setting the language level\n\nIntelliJ IDEA supports Java 27 from day one. In the *Project Structure*, set the *Language level* to *27 – No new language features*.\n\nIf you’re using preview features, set it to *27 (Preview) – Primitive types in patterns, instanceof, and switch (5th preview).* Note that IntelliJ IDEA will highlight the usage of preview features in the editor, so that you are aware of exactly where you’re using preview features.\n\n# New stable features in Java 27\n\nJava 27 introduced 4 new stable features. Let’s take a quick look.\n\n## [JEP 523: Make G1 the default garbage collector in all environments](https://openjdk.org/jeps/523)\n\nThe Garbage-First (G1) garbage collector has been the default garbage collector since Java 9, with one exception: Machines with only one CPU or less than 1,792 MB of RAM fell back to Serial GC. This JEP makes G1 the default garbage collector for the HotSpot JVM in all environments, not just server environments, replacing the Serial collector.\n\nImprovements were made to the G1 garbage collector (including [JEP 522: G1 GC: Improve Throughput by Reducing Synchronization in Java 26](https://blog.jetbrains.com/idea/2026/03/java-26-in-intellij-idea/#jep-522-g1-gc-improve-throughput-by-reducing-synchronization)) so that its performance is now sufficient to replace Serial. For applications in constrained environments that perform better with Serial, it can be explicitly enabled with the option `-XX:+UseSerialGC`.\n\n## [JEP 527: Post-quantum hybrid key exchange for TLS 1.3](https://openjdk.org/jeps/527)\n\nThis JEP enhances the security of Java applications that require secure network communication by implementing hybrid key exchange algorithms for TLS 1.3. This helps guard against “harvest now, decrypt later” attacks, where an adversary records encrypted traffic today with the intention of decrypting it once quantum computers are powerful enough.\n\n## [JEP 534: Compact object headers by default](https://openjdk.org/jeps/534)\n\nThis JEP makes compact object headers the default object header layout in the HotSpot JVM.\n\nBy reducing object headers from 96 bits to 64 bits on 64-bit architectures, compact object headers reduce heap size, improve deployment density, and increase data locality.\n\nCompact object headers were introduced as an experimental feature in Java 24 and became opt-in in Java 25. Since compact object headers are now the default, you no longer need to enable them using a command line option, like with JDK 25.\n\nApplications with large numbers of objects will benefit from this change, as using compact object headers reduces the JVM memory footprint. JetBrains IDEs are using this feature and have observed consistent memory savings with it enabled. [Learn more](https://youtrack.jetbrains.com/issue/IJPL-212987).\n\n## [JEP 536: JFR in-process data redaction](https://openjdk.org/jeps/536)\n\nThis JEP enhances the JDK Flight Recorder (JFR) by redacting command-line arguments and the initial values of environment variables and system properties in recordings before it leaves the process, so sensitive information does not leak.\n\n# Preview features in Java 27\n\nPreview features give developers a chance to try new features and provide feedback before they become final. Preview features might go through multiple rounds, either with or without changes, before they are finalized and become a standard part of the language.\n\nIntelliJ IDEA strives to support preview features, so you can experiment with them before they become standard. Because these features are always subject to change, IntelliJ IDEA only supports preview features for the current JDK. To enable preview features, set *Language l**evel* to *27 (Preview) – Primitive types in patterns, instanceof, and switch (5th preview).*\n\nJava 27 contains four preview features and one incubator feature. The features themselves are the same as in Java 26, but some of them have been revised in Java 27.\n\n## [JEP 531: Lazy constants (third preview)](https://openjdk.org/jeps/531)\n\nLazy constants are objects that hold immutable data. As the name suggests, they are evaluated lazily. This offers advantages over final fields, which are evaluated eagerly. With lazy constants, fields are evaluated only when needed, which can improve startup time.\n\nFor a slightly more detailed explanation, see the section on [*Lazy Constants in Java 26 in IntelliJ IDEA*](https://blog.jetbrains.com/idea/2026/03/java-26-in-intellij-idea/#jep-526-lazy-constants-second-preview).\n\nLazy constants were first introduced in Java 25 (as [stable values](https://openjdk.org/jeps/502)) and underwent significant  changes in Java 26. The API has been revised further in Java 27.  \n\n## [JEP 532: Primitive types in patterns, instanceof, and switch (fifth preview)](https://openjdk.org/jeps/532)\n\nAs [described](https://blog.jetbrains.com/idea/2026/03/java-26-in-intellij-idea/#jep-530-primitive-types-in-patterns-instanceof-and-switch-fourth-preview) in [*Java 26 in IntelliJ IDEA*](https://blog.jetbrains.com/idea/2026/03/java-26-in-intellij-idea/), this feature enhances pattern matching to support all primitive types in pattern contexts, including `instanceof` and `switch`. The feature removes some of the existing limitations of pattern matching, making it possible to match, test, and safely convert primitive values in these constructs. Removing the need for unsafe manual casts (which might cause subtle bugs) and range checks leads to improved code safety and readability. This feature is still in preview in Java 27, with no changes from the Java 26 version.\n\n### A quick example\n\nLet’s look at a quick example of using primitive types in switch expressions with guard patterns.\n\n```\nint itemDiscountPercentage(int items) {\n   return switch (items) {\n       case 2 -> 5;\n       case 3, 4 -> 10;\n       case int i when i >= 5 -> 20;\n       default -> 0;\n   };\n}\n```\n\nWe can add Javadoc to this method to explain how it works. As of Java 23 ([JEP 467](https://openjdk.org/jeps/467)), Javadoc can be written in Markdown. If your project uses JDK 23 or later, IntelliJ IDEA will insert Markdown documentation comments by default when you use the context action *Add Javadoc*.\n\nSidenote: If you prefer to use traditional comments instead of Markdown, open *Settings*, go to *Editor | Code Style | Java | Code Generation | Comment Code*, and deselect the *Prefer documentation line comments* option.\n\nIntelliJ IDEA can convert existing Javadoc to markdown using the context action *Convert to Markdown documentation comment*.\n\nYou can find a more detailed explanation of this feature in [this section](https://blog.jetbrains.com/idea/2024/09/java-23-and-intellij-idea/#primitive-types-in-patterns-instanceof-and-switch-preview-feature) of [*Java 23 and IntelliJ IDEA*](https://blog.jetbrains.com/idea/2024/09/java-23-and-intellij-idea/).\n\n## [JEP 533: Structured concurrency (seventh preview)](https://openjdk.org/jeps/533)\n\nAs [described](https://blog.jetbrains.com/idea/2026/03/java-26-in-intellij-idea/#jep-525-structured-concurrency-sixth-preview) in [*Java 26 in IntelliJ IDEA*](https://blog.jetbrains.com/idea/2026/03/java-26-in-intellij-idea/), structured concurrency gives us better “idioms” for multithreaded code, which means the code more closely matches the user’s mental model. \n\nStructured concurrency treats groups of related tasks running in different threads as single units of work. This improves readability and observability, making concurrent code easier to understand and reason about. It also helps eliminate thread leaks and cancellation delays.\n\nFor more details on structured concurrency and how it works together with other features from project Loom, please see my previous blog post, [*Project Loom in IntelliJ IDEA: Virtual Threads, Scoped Values, and Structured Concurrency*](https://blog.jetbrains.com/idea/2026/08/project-loom-in-intellij-idea-virtual-threads-scoped-values-and-structured-concurrency/).\n\nAs mentioned in that blog post, there is a live template for quickly scaffolding a `StructuredTaskScope`. You can pull up a list of available [live templates](https://www.jetbrains.com/help/idea/using-live-templates.html) in IntelliJ IDEA using the shortcut (*⌘J* on macOS / *Ctrl+J* on Windows and Linux). Alternatively, you can use [command completion](https://www.jetbrains.com/help/idea/command-completion.html): Type .. – and a list of all commands relevant to your current context will appear. You can even type part of the name of the command (for example “live” for Show live templates), and the relevant command will show up as part of regular completion. \n\nThe list of live templates is searchable, both by name and description. If we search for “structured”, we will find the live template `sts`.\n\nFor more information on command completion, see my previous blog post, [*Universal Entry Point: A Single Entry Point for Context-Aware Coding Assistance*](https://blog.jetbrains.com/idea/2025/11/universal-entry-point-a-single-entry-point-for-context-aware-coding-assistance/).\n\n## [JEP 538: PEM encodings of cryptographic objects (third preview)](https://openjdk.org/jeps/538)\n\nAs [described](https://blog.jetbrains.com/idea/2026/03/java-26-in-intellij-idea/#jep-524-pem-encodings-of-cryptographic-objects-second-preview) in [*Java 26 in IntelliJ IDEA*](https://blog.jetbrains.com/idea/2026/03/java-26-in-intellij-idea/), this JEP provides a preview API for encoding and decoding cryptographic objects (keys, certificates, and certificate revocation lists) to and from the Privacy-Enhanced Mail (PEM) format.\n\nThe API has undergone further changes in Java 27 compared to the previous version.\n\n# Incubator features in Java 27\n\n[Incubator modules](https://openjdk.org/jeps/11) are experimental APIs. They are explicitly non-final APIs and tools, made available for developers to try out. Unlike preview features, incubator features may change significantly, or even be removed in future releases. They are not intended for production use.\n\nTo use an incubator feature, you’ll need to explicitly add the module while you run the code, by adding the `--add-modules` command-line option for that specific module.\n\nIf you are running the code from IntelliJ IDEA, you can add command line options to the run configurations for your application. Select the run configuration for your program and click the three dots for *More Actions*. Select *Edit* to open the *Run/Debug Configurations*. Click the link *Modify Options*, and in the *Add Run Options* popup, select *Add VM Options*. A new field will appear with the hint VM Options. Add the command line option to that field.\n\n## [JEP 537: Vector API (twelfth incubator)](https://openjdk.org/jeps/537)\n\nAs [described](https://blog.jetbrains.com/idea/2026/03/java-26-in-intellij-idea/#jep-529-vector-api-eleventh-incubator) in [*Java 26 in IntelliJ IDEA*](https://blog.jetbrains.com/idea/2026/03/java-26-in-intellij-idea/), this JEP introduces an API that allows developers to express vector computations that reliably compile to optimal vector instructions on supported CPUs. Vector operations enable more work to be performed in a single CPU cycle, which can result in significant performance gains.\n\nAs this is an incubator module, you’ll have to provide a command line option to add the module explicitly, as described above. To use the Vector API, add the following command line option: `--add-modules jdk.incubator.vector`.\n\nThere are no changes to the Vector API in Java 27, compared to Java 26. This feature will continue to incubate until the required features of [Project Valhalla](https://openjdk.org/projects/valhalla/) become available as preview features.\n\n# Other changes: Debugger improvements\n\nOther than JEPs, JDK 27 contains bug fixes, like [JDK-6960970](https://bugs.openjdk.org/browse/JDK-6960970). The debugger was very slow during stepping. This has been fixed in JDK 27, which means that stepping through the debugger is faster now. Our engineers have [backported this fix to JetBrains Runtime (JBR) 25](https://youtrack.jetbrains.com/issue/JBR-10441), so they can use it when stepping during debugging the code for IntelliJ IDEA itself. This shows that it is possible to backport this change to Java 25 and that the change works correctly. If you want to take advantage of this change, you can use JBR 25 or ask your vendor to backport this change.\n\n# Looking ahead\n\nFeatures from Project Valhalla have started making their way into Java. Both [value objects (JEP 401)](https://openjdk.org/jeps/401) and [strict field initialization in the JVM (JEP 539)](https://openjdk.org/jeps/539) have been targeted to [JDK 28](https://openjdk.org/projects/jdk/28/) as preview features. This means that if you want to try out these features, you no longer have to download a special Valhalla distribution. You can download the JDK 28 EA (Early Access) version. This version is available for download from inside IntelliJ IDEA.\n\nIf you have already downloaded JDK 28 EA, you can point IntelliJ IDEA to your installation as well.\n\n# Conclusion\n\nWhile not an LTS release, Java 27 brings security and performance improvements and continues to evolve several important preview features. IntelliJ IDEA supports Java 27 from day one and will continue to support the latest Java features. Please let us know if you have any feedback.\n\n#### Subscribe to IntelliJ IDEA Blog updates", "url": "https://wpnews.pro/news/java-27-in-intellij-idea", "canonical_source": "https://blog.jetbrains.com/idea/2026/09/java-27-in-intellij-idea/", "published_at": "2026-09-15 14:49:02+00:00", "updated_at": "2026-09-15 16:47:59.169389+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Java 27", "IntelliJ IDEA", "JetBrains", "JDK 27", "HotSpot JVM", "G1 garbage collector", "SDKMAN!", "asdf"], "alternates": {"html": "https://wpnews.pro/news/java-27-in-intellij-idea", "markdown": "https://wpnews.pro/news/java-27-in-intellij-idea.md", "text": "https://wpnews.pro/news/java-27-in-intellij-idea.txt", "jsonld": "https://wpnews.pro/news/java-27-in-intellij-idea.jsonld"}}