A living example of Kotlin/Multiplatform with Java JNI integration and cinterop native integration.
Kotlin/Multiplatform doesn't run well with Visual C++.
Therefore Windows users need to download and setup either Cygwin or MSYS2, here comes a brief instruction on how to setup MSYS2 with GIT, OpenJDK and Gradle.
This brief instruction does not tell how to make Intellij IDEA work internally with MSYS2.
-
Download the Microsoft build of OpenJDK and install to
C:\Users\Forename Surname\.jdks
Presumably microsoft-jdk-16.0.2.7.1-windows-x64.
-
Download MSYS2 and install on your Windows computer.
-
Then open
MSYS2 MinGW x64
from your start menu. From within the MSYS2 Terminal, do the following:- Install Git
pacman -S git
. - Install Gradle
pacman -S gradle
. - Install a toolchain
pacman -S mingw-w64-x86_64-toolchain
. - Go to your KMP project folder
cd /c/Users/Forename\ Surname/IdeaProjects/kotlin-monorepo-gradle-multiproject-jni-cinterop/
. - Create the JAVA_HOME environment variable for Gradle
export JAVA_HOME="C:\Users\Forename Surname\.jdks\openjdk-16+36_windows-x64_bin\jdk-16"
- Run Gradle commands
./gradlew <command>
.
- Install Git