问题
I was earlier running my project using Java 1.7 but now I have to upgrade it to version 1.8. I have it installed as an alternative installation on my CentOS.
The location of Java8 is at /opt/jdk1.8.0_25/
and the current Java is at /usr/java/jdk1.7.0_67/
. My system's JAVA_HOME
also points to /usr/java/jdk1.7.0_67/
.
As soon as I add the new SDK I get this error: Cannot Save Settings: Please specify a different SDK name
.
How should I solve this issue?
回答1:
This means you already have a SDK with this name (cause the messge key in jetbrains is : sdk.list.unique.name.required.error
).
Remove the SDK before creating it once again.
To configure SDKs at the global (IDE) level
- Open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S).
- In the left-hand pane, under Platform Settings, click SDKs.
- To add a new SDK, click add and select the desired SDK type.
- In the dialog that opens, select the SDK home directory and click OK. As a result, a new SDK is added to IntelliJ IDEA, and its settings are shown on the SDK page in the right-hand part of the dialog.
- Optionally, edit the SDK name and contents.
- If necessary, add more SDKs as described above.
- Click OK in the Project Structure dialog.
To configure a project SDK
- Open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S).
- In the left-hand pane, under Project Settings, click Project.
- On the page that opens in the right-hand part of the dialog, select the necessary SDK from the Project SDK list.
- If the desired SDK is not present in the list, click New and select the necessary SDK type.
- In the dialog that opens, select the SDK home directory and click OK. As a result, a new SDK is added to IntelliJ IDEA and selected as the project SDK.
- To view or edit the SDK name and contents, click Edit. (The SDK page will open.)
- Click OK in the Project Structure dialog.
Source : IntelliJ IDEA 14.1.1 Help/Configuring Global, Project and Module SDKs
回答2:
I saw another situation that caused the same Intellij error when trying to add a new JDK:
Cannot Save Settings: Please specify a different SDK name.
In this case the problem was that there were already two JDKs listed with exactly the same name "1.8". (How this happened I don't know.) It was not a problem with the new JDK 11 that I was trying to add.
Once I deleted the duplicate JDK 1.8 from within "Project Structure... -> Platform Settings -> SDKs", I was then able to complete saving the newly added JDK 11.
I've added this in case it is useful to people encountering this Intellij error.
来源:https://stackoverflow.com/questions/31506278/unable-to-set-project-sdk-in-intellij