Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javax.xml.bind cannot be resolved

Tags:

java

xml

eclipse

I have a weird problem with an import I'm using in an Eclipse project. I am importing javax.xml.bind but I have an error saying that it cannot be resolved. My project's compliance is using Java 1.8, my JRE System Library is also 1.8. A friend of mine that is working on the code with me through Github has the same Java configurations in Eclipse but he is not having the same problem as I do. We have tried uninstalling and re installing the JRE for the project and still won't work. Does anyone know what's this all about?

like image 425
Galo Avatar asked Jul 13 '26 04:07

Galo


2 Answers

You might have configured a newer Java JDK/JRE (where javax.xml.bind is missing) in Window > Preferences: Java > Installed JREs.

Since Java 11 javax.xml.bind is not contained anymore in the system library and has to be added as a dependency (e.g. with this one).

like image 121
howlger Avatar answered Jul 15 '26 17:07

howlger


I'm working with Java 17. As mentioned javax.xml.bind is missing in newer JDKs.

Step 1: Go to this link .

Step 2: Select one of the Versions

Step 3: Copy the contents of dependency tag under Maven tab.

Step 4: Add the copied contents in pom.xml file within <dependencies> </dependencies> tags

Now you should be able to see an option to import required libraries.

like image 31
Shubhasmita Roy Avatar answered Jul 15 '26 19:07

Shubhasmita Roy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!