javaintellij-ideaintellij-15

Is com.sun.tools.javac.util available in openjdk 8?


I just installed openjdk 8 from brew in my Mac. However, when I am using Pair: "import com.sun.tools.javac.util.Pair;", although the IntelliJ did not report any error, but it promotes an error states that the "error: package com.sun.tools.javac.util does not exist". I remember the Java 8 contains Pair. Is openjdk 8 also contains Pair? If no, which version of openjdk contains Pair?


Solution

  • You can find JDK sources here:

    https://hg.openjdk.java.net/jdk/jdk13/

    as far as I can tell, it's still there:

    > find . -name "Pair.java" | grep javac
    ./src/jdk.compiler/share/classes/com/sun/tools/javac/util/Pair.java
    

    It looks like your env related issue.

    enter image description here

    It also works perfectly fine with Java 1.8

    adoptopenjdk

    Default download from: https://adoptopenjdk.net

    enter image description here

    Amazon Corretto

    Default download from: https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/what-is-corretto-8.html

    enter image description here