How to create jar file manually for a Compose Multiplatform project

Hi, I am trying to create a jar file manually from the classes created by Compose Multiplatform project in IntelliJ.

I tried:

jar cmf META-INF/MANIFEST.MF MainKt.jar  *.class

and it appears to work, but since I have not added the jar files containing the Compose classes, I get:

Error: Unable to initialize main class MainKt
Caused by: java.lang.NoClassDefFoundError: androidx/compose/runtime/MutableState

When trying to run said jar file with:

java -jar MainKt.jar

What jar files should I add to the classpath in order to get a valid MainKt.jar ?

Yes, it is usually not a good idea to build Java/Kotlin code manually. We would need to track and download all dependent libraries and by β€œall” I mean both direct and transitive deps, sometimes tens of them. Build systems were invented for a reason after all :slight_smile:

1 Like