JetBrains Fleet 1.48 Help

Getting started with Kotlin

This tutorial helps you get started with Kotlin development in JetBrains Fleet. It covers installation, project setup, and working with Kotlin code.

Prerequisites

Download and install JetBrains Toolbox

  • Download and install JetBrains Toolbox.

    For macOS, you can also download the installer that matches your processor type: Apple Silicon or Intel. Ensure you select the correct option based on your system's processor.

Download and install JetBrains Fleet

Set up a workspace

A workspace is the directory that contains your project. It includes both project files and settings. You can either open an existing project or start a new one by opening an empty directory.

In this tutorial, you will start a new project and initialize it using Gradle.

Open a workspace

  1. From the File menu, select Open ⌘ O.

  2. In the file browser, navigate to an empty folder where you want to store your code, then click Open.

When you open a directory, it becomes the root of a workspace. You can view its contents in the Files view.

The Files view in the left panel

Now let's initialize the project. This will generate boilerplate code and some examples that you can use to try out JetBrains Fleet in action. The steps differ depending on the build system. Use the tabs below to view the instructions for your chosen build system.

Initialize the project

  1. Make sure Gradle is installed on your computer.

  2. Press ⌃ ⇧ ` to open a terminal and run the gradle init command.

  3. When prompted, select the following options:

    • Project type: Application

    • Implementation language: Kotlin

    • Enter target Java version: press to accept the default value

    • Split functionality across subprojects: no

    • Build script DSL – Kotlin

    • Generate build using new APIs and behavior: no

    • Project name: press to accept the default value

    • Select application structure: press to accept the default value

    • Source package: press to accept the default value

By default, JetBrains Fleet uses the JDK from your JAVA_HOME environment variable. Before proceeding, make sure it is configured in your environment. Otherwise, you can configure a custom JDK for your project.

Configure project JDK

  1. Press ⌘ , to open settings and select Toolchains | Java Runtime.

  2. From the JDK drop-down list, select one of the available JDKs. If no JDK is detected, you can add one manually by specifying the path to the required JDK.

    Java Runtime section in project settings

Smart Mode

You can use JetBrains Fleet as a smart text editor, rather than a full-fledged code editor. However, if you need code intelligence features, you can enable them by turning Smart Mode on.

Enable Smart Mode

  • In the top-right corner of the window, click Smart Mode, then Enable.

    After you click the Enable button, you may have to wait for some time, while the backend is being prepared.

    Smart Mode popup

JetBrains Fleet provides a variety of coding assistance features. Below are a few examples to help you get a sense of how they work in practice. This is not a complete list, but a good starting point for exploring what JetBrains Fleet can do.

Use quick-fixes and intention actions

  • Press ⌥ ⏎ to access actions that Fleet suggests in the current context.

    A popup shows the available fixes for the code at the caret

Refactor code

  • Place the caret on a literal or select an expression, then press ⌘ ⌥ V.

    A variable will be extracted from the selected expression.

    Choosing a new name for the symbol at the caret

    A variable will be extracted from the selected expression.

  • Navigate to a symbol’s declaration by pressing ⌘ B.

  • Use code interlines to navigate to usages and hierarchy members.

    An interline shows the usages count for a symbol
  • Navigate between errors using ⌘ E and ⌘ ⇧ E.

Use live templates

  • To generate a for loop, type iter and press . Press as you fill in the necessary variables.

    Populating the for loop template

Run and debug

With Smart Mode enabled, you can run your project.

Run from the editor

  • Navigate to the entry point of your application and click the run icon in the gutter. Select Run.

    A popup appears upon clicking the gutter icon asking whether we want to run or debug the application

Another way to run a program is to use a run configuration. It allows you to customize the startup: add arguments, VM options, use custom commands, and so on.

Create a run configuration

  1. Press ⌘ R. Run & Debug dialog opens.

    Create Run Configurations option in the Run and Debug popup

    Click Create Run Configurations.

  2. In run.json, append a gradle run configuration to the array, so that the resulting JSON looks like the following:

    { "configurations": [ { "name": "run sh", "type": "command", "program": "/bin/sh" }, { "name": "gradle run", "type": "gradle", "tasks": [ "run" ] } ] }

Launch a run configuration

  • Press ⌘ R. The Run dialog opens. Select the newly created gradle run configuration.

    The application runs, and you can review its output in the console that opens.

    The task output is shown in the console

Debug the application

  1. Set a breakpoint by clicking at an executable line in the gutter. This will suspend the application just when this line is about to execute.

    A circle in the gutter indicating a breakpoint
  2. Run the application by selecting Debug from the gutter menu or in the Run dialog.

  3. Inspect the program state in the Run and debug panel. As we are using a hello-world type of app here, we don't have a lot of state to inspect.

    The buttons above the threads list let you control the program execution. You can advance it line-by-line, step in and out of methods, resume and stop the program.

    Threads are shown in the Debug panel
19 May 2025