← All stories
1 min read Updated Sep 22, 2026

Kotlin デスクトップ・アプリケーション開発

Java SE で標準的な GUI ライブラリとして利用されている JavaFX。このライブラリを Kotlin で利用するために広く用いられている TornadoFX という IntelliJ IDEA のプラグインがあります。 これを使用するためには IntelliJ IDEA 上で Ctrl + Alt + s キーを押して Settings ウィンドウを開き、Plugins > Marketplace タブから TornadoFX を選択してインストールした後、IDE を再起動します。 しかし、JavaFX は JDK11 から独立したモジュールとなり、JDK に含まれなくなったため、2021年現在ではプラグインをインストールしただけでは利用できません。 実際には以下のようなエラーを吐き出して実行に失敗します。 Cannot access 'javafx.application.Application' which is a supertype of ... そこで MavenCentral から JavaFX を取得するように build.gradle (tornadofx-gradle-project) を編集します。
plugins {
    id 'org.openjfx.javafxplugin' version '0.0.10'
}

javafx {
    version = '11'
    modules = [ 'javafx.controls', 'javafx.fxml' ]
}

$ java -version openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04) OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

TornadoFX 1.7.20.1

IntelliJ IDEA 2021.3 (Community Edition)
Build #IC-213.5744.223, built on November 27, 2021
Runtime version: 11.0.13+7-b1751.19 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Share this story
X Email RSS

Comments

No comments yet. Leave the first one.

Leave a comment

Image verification to prevent automated comments

Comments are moderated before they appear.

Sponsored