2015-08-06 17:38:04 +01:00

1.7 KiB

title
SDK

Every project uses a Software Development Kit (SDK). For Java projects, SDK is referred to as JDK (Java Development Kit). SDK determines which API library is used to build the project. If your project is multi-module, the project SDK by default is common for all modules within the project. Optionally, you can configure individual SDK for each module. For more information about SDKs, see JDKs and Configuring Project JDK in IntelliJ IDEA Web Help.

Getting Project Sdk Information

Main information about the project Sdk can be accessed via ProjectRootManager.java like the following example shows

String projectSdk = ProjectRootManager.getInstance(project).getProjectSdk();

Getting And Setting Project SDK Attributes

  • To get the project-level SDK

    Sdk projectSDK = ProjectRootManager.getInstance(project).getProjectSdk();
    
  • To get the project-level SDK name:

    String projectSDKName = ProjectRootManager.getInstance(project).getProjectSdkName();
    
  • To set the project-level SDK:

    ProjectRootManager.getInstance(project).setProjectSdk(Sdk jdk);
    
  • To set the project-level SDK name:

    ProjectRootManager.getInstance(project).setProjectSdkName(String name);
    

See the following code sample to get more familiar with SDK manipulation tool set.