IntelliJ IDEA 2017.2 Help

Working with SDKs

What are SDKs for?

To develop applications, you need a Software Development Kit (SDK). A typical SDK example is the Java Development Kit (also known as JDK or Java SDK). This is an SDK for producing Java applications.

IntelliJ IDEA does not include an SDK. So, before you start writing your code, you have to download and install at least one SDK, and define it in IntelliJ IDEA. (You can specify an SDK when creating your first project or at a later time.)

To define an SDK in IntelliJ IDEA, generally, all you have to do is to specify its location. (This location, normally, is referred to as the SDK home directory. This is the directory in which the SDK is installed). Additional SDK adjustments are possible, however, in most of the cases, they are not necessary.

Supported SDKs

Depending on the nature of your application, you can use:

  • Java SE Developments Kits (JDKs) to develop Java desktop and enterprise applications.
  • Mobile SDKs (Java Micro Edition (ME) SDKs) to develop applications for Java-enabled mobile devices.
  • Android SDKs to develop applications for Android devices.
  • Flex and AIR SDKs to develop applications for the Adobe Flash platform.
  • Flexmojos SDKs to launch the Flex compiler and debugger. (Such SDKs are created by IntelliJ IDEA automatically when importing Flexmojos projects.)
  • IntelliJ Platform Plugin SDKs to develop plugins for IntelliJ IDEA. (An IntelliJ IDEA installation acts as an IntelliJ Platform Plugin SDK.)

Note that the set of supported SDK types depends on the IntelliJ IDEA edition being used (Community or Ultimate) and also on which plugins are currently enabled.

SDK levels

All the SDKs, generally, are global: irrespective of when and where you define an SDK, you can then use it in any of your projects.

One of the SDKs is assigned to a project and is referred to as a project SDK. This SDK is used by default by all the modules of the corresponding project.

A module can use ("inherit") the project SDK, or, alternatively, a module-specific SDK can be specified.

SDK contents (classpath, sourcepath, and documentation paths)

When you define a new SDK, IntelliJ IDEA analyses the contents of the SDK installation folder (home directory) to find out where the corresponding binaries, sources and associated documentation are located. As a result, all the appropriate locations within the SDK are translated into corresponding paths and assigned to one of the following categories:

Classpath. This is a set of paths to directories and archives containing the SDK binaries. For a JDK, for example, this set includes the paths to class directories and JAR files that make up the Java API and its extensions.

You can add more SDK libraries to this set, however, this is never necessary for any standard SDK.

Sourcepath. This is a set of paths to directories and archives containing the source code for the SDK binaries included in the classpath set.

Including the source files isn’t required, but doing so improves IntelliJ IDEA’s ability to provide inline help while coding (View | Quick Documentation or Ctrl+Q).

Documentation paths. This is a set of paths to documentation that describes the SDK source code.

Including documentation paths is also optional, but doing so gives you the ability to view documentation directly from the IDE (View | External Documentation or Shift+F1).

If online documentation is available for the SDK, you can add the corresponding URL to the SDK documentation paths (icon doc url) to be able to access this documentation when needed.

Defining an SDK when creating a project or module

You can define a new SDK when creating a project or module. See e.g. Creating a project in Creating, Running and Packaging Your First Java Application.

sdks new project

As a result, the SDK definition will appear at the IDE level. In addition to that:

  • If you defined an SDK when creating a project, the SDK will be assigned to the project as the default project SDK. The module that is created together with the project will inherit the project SDK.
  • If you defined an SDK when creating a module, the SDK will be assigned to the module.

Managing global, project and module SDKs

Most of the tasks related to working with SDKs are performed in the Project Structure dialog (File | Project Structure). Depending on the SDK level:

Global (IDE). To see all the SDKs that you have available, select SDKs.

sdks project structure sdks

To define a new SDK, click add, select the SDK type (e.g. JDK), and then specify the SDK installation directory.

Project. To see which SDK is being used as the project default SDK, select Project.

sdks project structure project

If you want to use a different SDK, select that SDK from the list. If the SDK that you want is not defined in IntelliJ IDEA yet, click New to start adding its definition.

Note that if you change the project SDK, all the modules that are using the default project SDK will change their SDK accordingly.

Module. To see which SDK is used by a module, select Modules, select the module of interest, and then select Dependencies.

sdks project structure modules dependencies

If you have the text Project SDK in the Module SDK field, the module is using the project default SDK. To specify a different SDK for the module, use the list or the New button.

Making Apple JDK sources accessible in IntelliJ IDEA on macOS

The Apple JDK included in macOS installation doesn't contain the JDK sources. So to make those sources accessible in IntelliJ IDEA, you should download and install the Java for macOS Developer Package and then add the JDK sources contained in this package (src.jar) to the definition of the corresponding JSDK in IntelliJ IDEA.

  1. In a Web browser, go to the Downloads for Apple Developers page.
  2. Sign in to the downloads page using your Apple developer account (Apple ID and password).
  3. Download and install the Java for macOS Update Developer Package suitable for the macOS version that you are using.
  4. In IntelliJ IDEA, open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S) and select SDKs.
  5. Select the Apple JDK of interest. (If the corresponding JDK is not present in the list, add its definition: add | JDK, etc.)
  6. On the SDK page shown in the right-hand part of the dialog, select the Sourcepath tab and click new (Alt+Insert).
  7. In the dialog that opens, select the file src.jar and click OK.

    (Usually, this file is located in


    where <java.version> is your JDK version, for example, 1.6.0_31-b04-415.jdk or something similar.)

  8. Click OK in the Project Structure dialog.
Last modified: 29 November 2017