[Fixed] IntelliJ IDEA + JDK 21 issue with java.util.concurrent package – TimeUnit class not available – Java

Ali Hasan
intellij-idea java java-21 java.util.concurrent

Quick Fix: To resolve this issue, update IntelliJ to version 2023.2.5 or later. Repeat the update process multiple times if necessary until the problem is solved.

The Problem:

A developer is facing an issue while using the TimeUnit class from java.util.concurrent package in IntelliJ IDEA 2023.1.5 with Oracle JDK 21.0.1. Despite setting up JDK 21 in the project structure, the TimeUnit class is not recognized by the IDE, while other classes from the concurrent package are imported without issues. The app runs successfully despite the error, but the developer is concerned about the underlying cause and seeks assistance in resolving this problem.

The Solutions:

Solution 1: Update IntelliJ Multiple Times

The issue lies in the outdated IntelliJ IDEA version. To resolve it, manually update IntelliJ to the latest version, and if the issue persists, perform the update process multiple times consecutively. This ensures that all necessary updates are applied, resolving the issue with the TimeUnit class from java.util.concurrent not being available.


Why is TimeUnit class not available in IntelliJ IDEA with JDK 21?

IntelliJ IDEA may require multiple updates to resolve the issue.

Why does IntelliJ IDEA say version 17 when using JDK 21?

IntelliJ IDEA’s Runtime version is independent of the JDK version.

Video Explanation:

The following video, titled "How to fix Webdriver wait or implicitly wait deprecated message ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

In this video we have shown how to fix below error related to implicitly wait and explicitly wait: “Timeouts org.openqa.selenium.WebDriver.