Can we develop desktop applications in kotlin?
Asked Answered
U

1

15

I want to develop Desktop and Android applications. And I want to learn kotlin for this. Kotlin is mostly used for developing Android applications but I want to know that can we develop desktop applications in kotlin?

Unity answered 5/2, 2021 at 10:32 Comment(2)
“Kotlin is mostly used for developing Android applications” — a common view, but not entirely accurate.  Lots of people use Kotlin for server-side systems, web front-ends, web back-ends, desktop apps, libraries and frameworks, data analysis, and many other things.  JVM and Android are targetted about equally; details here.Northamptonshire
"Is it possible to ____?" is generally considered too broad to be a good question for Stack Overflow—the answer is usually: "yes, it's probably possible, but describing how to do it would entail designing a large piece of software." Instead, you should try to build it, and ask a question when you encounter a specific problem. Please see Why is “Is it possible to…” a poorly worded question? for more information.Negrito
B
12

Yes, you can. Technically any program you can write in Java can also be written in Kotlin*. Of course it's even better when using frameworks that were specially tailored for Kotlin.

There are frameworks like TornadoFX built on top of JavaFX to build desktop UIs.

More recently, Compose has been generalized for Desktop apps (initially JetPack Compose for Android).

*More specifically, Kotlin/JVM compiles to Java bytecode, so you can use Kotlin to target any environment running a JVM that interprets this bytecode (provided the target bytecode version is at most that of the JVM, like in Java). As pointed out by @Tenfour04, GWT is not in this category because it directly works on the Java source code, not bytecode.

Builder answered 5/2, 2021 at 10:40 Comment(3)
Except for GWT. You can write in Java but not Kotlin because GWT “compiles” Java to JavaScript.Manuel
@Manuel fair enough. Will rephraseBuilder
It is 2023 and Compose is still missing a lot of basic stuff and buggy.Royston

© 2022 - 2024 — McMap. All rights reserved.