SOLUTION
I've heard that many people have this problem/question, so I think the solution I've found would be better shared, and I'll even explain it in a bit details:
There are actually two distinct points of this problem I was considering:
- jdk version for building(compiling) the project;
- jdk version for the Web Container (Tomcat) you're going to run your project on (in IntelliJ, it's under Run/Debug Configurations, you will have to specify the jdk for your server).
Turns our, that it does not matter whether you'll use java compiler/jdk 8 or 11, it works in both cases, you've built it with jdk8 or jdk11 (You'll just have to consider, that by default jaxb (package javax.xml.bind.annotation
) is removed from jdk11, so you'll add it manually as a dependency/jar). What really matters, is the version of Java you're providing for your Web Container.
If (for instance) Tomcat will run on jdk11, JAXB won't work even if you'll have it on the classpath and disregarding of which version of Java you used to build your project.
On the other hand, if you'll provide the jdk8 as a platform for your server (Edit/Debug Configurations in IntelliJ), then JAXB will work disregarding of which Java you've used to build your project (with jdk11 you'll add a dependency/jar, with jdk8 it's provided in rt.jar).