Microsoft's OpenJDK 17.0.8.1 LTS build gives me the error "The selected directory points to a JRE, not a JDK" when trying to set it as the SDK
I downloaded the build from here https://learn.microsoft.com/fi-fi/java/openjdk/download#openjdk-17 and used the zip package instead of the msi installer, unzipped it straight onto the C drive, set up the environment variables PATH and JAVA_HOME appropriately, tried the command “java -version” in cmd and everything seemed ok, but when I went to fire up IDEA and tried to select it as the SDK from within the Project Structure settings, it just gave me the titular error message. I have previously used the OpenJDK 17.0.2+8 build from here https://jdk.java.net/archive/ with the exact same steps and it worked just fine. What am I doing wrong? I tried reading the other similiar threads but could not for the life of me understand what they were saying.
请先登录再写评论。
Hello, DeveloperDave1337. Unfortunately, I couldn't reproduce the issue on my side; after unzipping the archive, I didn't encounter the error you mentioned.
Could you please check if moving the JDK to another location helps? Typically, the JDKs on Windows should be stored in the
C:\Users\<username>\.jdksdirectory.It seems that the problem was caused by trying to unzip the files straight onto the C drive, which is my system drive. I was using 7-zip and it gave me a strange warning about some leftover data in the zip file that was not able to be extracted, which leads me to expect that some of the missing files and/or folders were the reason why IDEA didn't want to recognize it as a fully fledged JDK and was thinking it was a JRE. I redownloaded the zip file and this time unzipped it into the same folder where the zip file itself was, which was my browser's default downloads folder, and then copied it onto the C drive, and this time it gave me no errors and IDEA recognized it as a JDK just fine. My guess is that Windows 10 has some wonky default permissions for programs in terms of writing files onto the root of the system drive. Anyways, problem solved.
Thank you for the update; I'm glad the issue is solved now.
Please, feel free to contact us in case of any questions or requests.