Using Kotlin in extensions.

Stuart Beesley (Mr Toolbox)'s Avatar

Stuart Beesley (Mr Toolbox)

27 Sep, 2024 02:43 PM

FYI. It’s possible to use Kotlin within moneydance extensions (mxt files). The code can be all Java, all Kotlin, or mixed Java/Kotlin.

The Kotlin target must be Java/JVM bytecode.

The moneydance_open repo on GitHub has been recently updated; so if you fork that and look at the ant build.xml file you will see how it’s enabled.

Essentially for ant:
- you must first have the Kotlin compiler installed (either manually, or by having IntelliJ installed)

  • to the build file you add:
    <typedef resource="org/jetbrains/kotlin/ant/antlib.xml" classpath="pathto/kotlin-ant.jar"/>
    

Then, within the <javac> task, you add:

<withKotlin/>

Don’t forget to update your includes statement to include the *.kt files too!

Your project must also have the Kotlin dependency. As soon as you add a Kotlin file, then IntelliJ should add this for you anyway.

The simple approach is probably to use the Kotlin tools to convert one class from Java to Kotlin and see how that works.

Refer: https://www.jetbrains.com/help/idea/get-started-with-kotlin.html

  1. System closed this discussion on 27 Dec, 2024 02:50 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac