An Integrated Development Environment (IDE) provides code completion, debugging, and project management tools that make Kotlin development much easier. This guide covers setting up popular IDEs for Kotlin development.
Prerequisites
Install JDK (Java Development Kit)
Kotlin runs on the JVM, so JDK installation is required:
Step 1: Download JDK 8 or later from:
Step 2: Install and verify:
java -version
Expected output:
java version "1.8.0_xxx" or higher
Recommended IDEs for Kotlin
1. IntelliJ IDEA (Recommended)
Best for: All Kotlin development (server-side, multiplatform, scripting)
Advantages:
- Created by JetBrains (Kotlin creators)
- Best Kotlin support and tooling
- Built-in Kotlin plugin
- Intelligent code completion
- Advanced refactoring tools
Download: IntelliJ IDEA
Editions:
- Community (Free): Perfect for learning Kotlin
- Ultimate (Paid): Additional features for web/enterprise development
2. Android Studio
Best for: Android app development
Advantages:
- Official Android IDE
- Based on IntelliJ IDEA
- Kotlin fully supported and recommended
- Android-specific tools and emulators
Download: Android Studio
3. Eclipse
Best for: Developers already familiar with Eclipse
Note: Requires Kotlin plugin installation
Download: Eclipse
4. Visual Studio Code
Best for: Lightweight development
Requirements: Install Kotlin extension from marketplace
Download: VS Code
Complete Setup: IntelliJ IDEA
Step 1: Download IntelliJ IDEA
- Visit JetBrains IntelliJ IDEA
- Choose your operating system
- Download Community Edition (free) or Ultimate (trial/paid)
Step 2: Install IntelliJ IDEA
Windows:
- Run the downloaded
.exefile - Follow installation wizard
- Choose installation directory (default is fine)
- Select options:
- ✓ Create Desktop Shortcut
- ✓ Add "bin" folder to PATH
- ✓ Add "Open Folder as Project"
- Click "Install"
macOS:
- Open the downloaded
.dmgfile - Drag IntelliJ IDEA to Applications folder
- Launch from Applications
Linux:
tar -xzf ideaIC-*.tar.gz
cd idea-IC-*/bin
./idea.sh
Step 3: First Launch Configuration
- Accept License Agreement
- Choose UI Theme: Light or Dark (Darcula)
- Install Featured Plugins: Skip or select as needed
- Kotlin plugin: Pre-installed (no action needed)
- Open IntelliJ IDEA
- Go to: File → Settings → Plugins (Windows/Linux)
Step 4: Verify Kotlin Support
- Or: IntelliJ IDEA → Preferences → Plugins (macOS)
- Search for "Kotlin"
- Verify Kotlin plugin is Enabled
- Click New Project on welcome screen
- Select Kotlin from left sidebar
- Choose Kotlin/JVM for general Kotlin projects
- Click Next
- Project Name: Enter your project name (e.g., "HelloKotlin")
- Location: Choose project directory
- Build System: Select Gradle (recommended) or Maven
- JDK: Select installed JDK (or download automatically)
- Click Finish
Creating Your First Kotlin Project
Step 1: Create New Project
Step 2: Configure Project
Step 3: Project Structure
IntelliJ creates this structure:
HelloKotlin/
├── src/
│ └── main/
│ └── kotlin/
│ └── Main.kt
├── build.gradle.kts
└── settings.gradle.kts
Creating Your First Kotlin File
Step 1: Create Kotlin File
- Right-click on
src/main/kotlin/ - Select New → Kotlin Class/File
- Choose File
- Name it:
Main(extension.ktadded automatically) - Click OK
Step 2: Write Code
In Main.kt, write:
fun main() {
println("Hello from IntelliJ IDEA!")
}
Step 3: Run the Program
Method 1: Click the green play button (▶) next to main function
Method 2: Right-click in editor → Run 'MainKt'
Method 3: Keyboard shortcut:
- Windows/Linux:
Ctrl + Shift + F10 - macOS:
Ctrl + Shift + R
Step 4: View Output
The Run window appears at the bottom showing:
Hello from IntelliJ IDEA!
Process finished with exit code 0
IntelliJ IDEA Kotlin Features
1. Code Completion
As you type, IntelliJ suggests:
- Function names
- Variable names
- Keywords
- Import statements
Press Tab or Enter to accept suggestions.
2. Quick Fixes
Hover over red/yellow underlines for:
- Error explanations
- Quick fix suggestions
- Refactoring options
3. Code Formatting
Auto-format code:
- Windows/Linux:
Ctrl + Alt + L - macOS:
Cmd + Option + L
4. Refactoring
Rename variables/functions safely:
- Right-click → Refactor → Rename
- Or:
Shift + F6
5. Debugging
Set breakpoints and debug:
- Click in left margin to add breakpoint (red dot)
- Click debug icon (🐞) instead of run
- Use debug controls to step through code
Android Studio Setup
For Android development:
- Download Android Studio
- Install with default settings
- Launch Android Studio
- Create New Project
- Choose Empty Activity
- Select Kotlin as language
- Configure app details
- Click Finish
Kotlin is pre-configured in Android Studio.
VS Code Setup
Step 1: Install Kotlin Extension
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X) - Search: "Kotlin"
- Install "Kotlin Language" by mathiasfrohlich
- Search: "Code Runner"
- Install by Jun Han
- Enables quick code execution
Step 2: Install Code Runner (Optional)
Step 3: Configure
Create settings.json:
{
"code-runner.executorMap": {
"kotlin": "kotlinc $fullFileName -include-runtime -d $fileNameWithoutExt.jar && java -jar $fileNameWithoutExt.jar"
}
}
Comparison: Which IDE to Choose?
| IDE | Best For | Kotlin Support | Free |
|---|---|---|---|
| IntelliJ IDEA | All Kotlin development | Excellent | Community: Yes |
| Android Studio | Android apps | Excellent | Yes |
| Eclipse | Eclipse users | Good (plugin) | Yes |
| VS Code | Lightweight editing | Basic | Yes |
Tips for Beginners
- Start with IntelliJ IDEA Community: Best learning experience
- Use Code Completion: Type less, learn faster
- Learn Shortcuts: Improves productivity significantly
- Enable Auto-Import: Automatically imports needed classes
- Use Built-in Terminal: No need to switch windows
Common Issues
Issue: "No JDK Configured"
Solution:
- File → Project Structure → Project
- Set Project SDK to your JDK
- Apply changes
Issue: Kotlin Plugin Not Found
Solution:
- File → Settings → Plugins
- Search "Kotlin"
- Install/Enable plugin
- Restart IDE
Issue: Slow Performance
Solution:
- Increase IDE memory: Help → Edit Custom VM Options
- Add:
-Xmx2048m(increase heap size) - Restart IDE
Next Steps
- Create your first Kotlin project
- Explore code completion features
- Learn essential keyboard shortcuts
- Try debugging with breakpoints
- Build a simple calculator app