Do you want to work on this issue?
You can request for a bounty in order to promote it!
Error with `libtiled` in Java 21: `java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException` #3919
ajh123 posted onGitHub
Describe the bug
When I create an instance of org.mapeditor.io.MapReader
the following error is produced: Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
To Reproduce
Steps to reproduce the behavior:
1.
Import libtiled
into your Java project, for example the following Gradle:
plugins {
id 'java'
}
repositories {
mavenCentral()
}
sourceCompatibility = 21
targetCompatibility = 21
dependencies {
testImplementation platform('org.junit:junit-bom:5.9.1')
testImplementation 'org.junit.jupiter:junit-jupiter'
implementation 'org.mapeditor:libtiled:1.4.2'
}
test {
useJUnitPlatform()
}
2.
Somewhere in your code create an instance of MapReader
, for example:
import org.mapeditor.io.MapReader;
public class App {
public static void main(String[] args) {
MapReader reader = new MapReader();
}
}
- Run the program
- See error
Expected behavior A clear and concise description of what you expected to happen.
I expect an instance of MapReader
to be created without any errors.
Media If applicable, add screenshots or videos to help explain your problem.
N/A
Specifications:
OS: [e.g. Windows 10]: Windows 10: (I don't think this matters because the issue comes from Java it self).
Tiled Version: [e.g. 1.0.0. You can get this from Help -> About Tiled]: 1.10.2 (I don't think this actually matters with this).
Java version
> java --version openjdk 21.0.2 2024-01-16 LTS IBM Semeru Runtime Open Edition 21.0.2.0 (build 21.0.2+13-LTS) Eclipse OpenJ9 VM 21.0.2.0 (build openj9-0.43.0, JRE 21 Windows 10 amd64-64-Bit Compressed References 20240116_95 (JIT enabled, AOT enabled) OpenJ9 - 2c3d78b48 OMR - ea8124dbc JCL - 78c4500a434 based on jdk-21.0.2+13)
Semi-related issues #3284 https://stackoverflow.com/questions/43574426/how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexception
Until a proper solution is made, I would like to know if there are any workarounds available.