Unable to set project SDK in Intellij

Animesh Pandey picture Animesh Pandey · Jul 19, 2015 · Viewed 12.2k times · Source

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?

Answer

Anthony Raymond picture Anthony Raymond · Jul 19, 2015

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

  1. Open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S).
  2. In the left-hand pane, under Platform Settings, click SDKs.
  3. To add a new SDK, click add and select the desired SDK type.
  4. 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.
  5. Optionally, edit the SDK name and contents.
  6. If necessary, add more SDKs as described above.
  7. Click OK in the Project Structure dialog.

To configure a project SDK

  1. Open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S).
  2. In the left-hand pane, under Project Settings, click Project.
  3. On the page that opens in the right-hand part of the dialog, select the necessary SDK from the Project SDK list.
  4. If the desired SDK is not present in the list, click New and select the necessary SDK type.
  5. 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.
  6. To view or edit the SDK name and contents, click Edit. (The SDK page will open.)
  7. Click OK in the Project Structure dialog.

Source : IntelliJ IDEA 14.1.1 Help/Configuring Global, Project and Module SDKs