I'm trying to get a Compose desktop app to start u...
# ktor
k
I'm trying to get a Compose desktop app to start up w/ JDK8 so it can warn the user that JDK11 is required by setting the targetCompatibility to 1.8, but it fails because it looks like Ktor is targeting JDK11:
Copy code
Exception in thread "main" java.lang.UnsupportedClassVersionError: io/ktor/client/engine/java/JavaHttpEngineContainer has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Does Ktor have to target JDK11? i.e. can it target JDK8? This seems like a fairly common use case (especially on OSX where Apple decided to ship w/ JDK8 by default).
dug a bit and it looks like it might be related to this? https://youtrack.jetbrains.com/issue/KTOR-4800
a
Because Java's HTTP client has been introduced in JDK 11.
k
ahh...not obvious...Thanks. I'll mention it in that issue as well.
e
(especially on OSX where Apple decided to ship w/ JDK8 by default).
Apple doesn't ship any Java anymore, and I don't think they were ever on 8
https://support.apple.com/kb/dl1572 is the last one AFAIK, and it's Java 6
🤔 1
s
Also if you package for the OS, compose will use JPackage and the runtime will be shipped together. I suggest to use the latest possible LTS, give always some small advantages and JDK 8 is end of life (or close by).
k
if you package for the OS, compose will use JPackage and the runtime will be shipped together
This actually sounds like what I want...how do you specify the JRE that gets bundled? I couldn't find anything obvious here: https://github.com/JetBrains/compose-multiplatform/blob/master/tutorials/Native_distributions_and_local_execution/README.md
ahh..it's part of jpackage itself: https://docs.oracle.com/en/java/javase/17/docs/specs/man/jpackage.html So it the runtime you build with is the JRE that gets pulled in via jlink.
s
also there is the gradle task
runDistributable
that create a distributable image and run it without installing. For mac not sure if it's able to create a arm64/intel version, something you have to verify by yourself or check the documentation.