Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ IDEA: Project SDK Settings is not retained after reopenning IDE

Whenever I open IDEA it spends some time in indexing and then shows lots of errors. I have to go to 'Project Settings' and select the SDK. Somehow IDE forgets my settings on close and returns to "Project SDK: ".

I really appreciate any clue.

like image 967
Asad Iqbal Avatar asked Jan 17 '12 05:01

Asad Iqbal


People also ask

Where are IntelliJ project settings stored?

Project settings are stored in the project directory as a set of XML files under the . idea folder. This folder contains both user-specific settings that shouldn't be placed under version control and project settings that are normally shared among developers working in a team, for example, the code style configuration.

How do I find my project SDK in IntelliJ?

From the main menu, select File | Project Structure | Project Settings | Project. If the necessary SDK is already defined in IntelliJ IDEA, select it from the SDK list. If the SDK is installed on your computer, but not defined in the IDE, select Add SDK | 'SDK name', and specify the path to the SDK home directory.

How do I change the default settings in IntelliJ?

From the main menu, select File | Manage IDE Settings | Restore Default Settings. Alternatively, press Shift twice and type Restore default settings . Click Restore and Restart. The IDE will be restarted with the default configuration.


1 Answers

Try to create a new project and see if the issue remains. JDK configuration is stored by name in the .idea directory, verify that XML files in this directory are not changed externally (for example, via Dropbox or Version Control).

misc.xml file should contain something like:

  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
    <output url="file://$PROJECT_DIR$/bin" />
  </component>

Module .ipr files can have module specific JDK defined:

<orderEntry type="jdk" jdkName="1.6" jdkType="JavaSDK" />

JDK definition itself is stored in IDEA configuration directory inside options\jdk.table.xml file.

So, you need to check all the 3 locations above (misc.xml, .ipr file, jdk.table.xml file) to verify that they are not changed between restarts and that JDK configuration remains the same.

Verify that IDEA configuration and all the project files are located on the local drives, remote drives can cause such issues. Using encrypted partitions/folders is also not recommended.

like image 84
CrazyCoder Avatar answered Nov 01 '22 20:11

CrazyCoder