Categories:
Audio (13)
Biotech (29)
Bytecode (35)
Database (77)
Framework (7)
Game (7)
General (512)
Graphics (53)
I/O (32)
IDE (2)
JAR Tools (86)
JavaBeans (16)
JDBC (89)
JDK (337)
JSP (20)
Logging (103)
Mail (54)
Messaging (8)
Network (71)
PDF (94)
Report (7)
Scripting (83)
Security (32)
Server (119)
Servlet (17)
SOAP (24)
Testing (50)
Web (19)
XML (301)
Other Resources:
Identify JAXB Implementation Classes
How to Identify JAXB Implementation Classes?
✍: FYIcenter.com
You can use the following simple Java program, JaxbClassInfo.java,
to Identify JAXB Implementation Classes:
// Copyright (c) FYIcenter.com import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; public class JaxbClassInfo { public static void main(String[] args) throws Exception { JAXBContext c = JAXBContext.newInstance("com.fyicenter.demo"); Marshaller m = c.createMarshaller(); System.out.println("JAXB Implementation Classes:"); System.out.println(" JAXBContext: "+c.getClass()); System.out.println(" Marshaller: "+m.getClass()); } }
Compile and run JaxbClassInfo.java as shown below in the .\src\ folder, where the data type classes were generated by XJC:
fyicenter> cd src fyicenter> java -cp .:../jaxb-ri/mod/jaxb-api.jar:\ ../jaxb-ri/mod/jaxb-runtime.jar:\ ../jaxb-ri/mod/istack-commons-runtime.jar:\ ../jaxb-ri/mod/javax.activation-api.jar \ JaxbClassInfo.java JAXB Implementation Classes: JAXBContext: class com.sun.xml.bind.v2.runtime.JAXBContextImpl Marshaller: class com.sun.xml.bind.v2.runtime.MarshallerImpl
As you can see, the reference implementation of JAXB API has the "com.sun.xml.internal.bind" package name.
But the Java SE implementation of JAXB API bundled in Java 8 has a different package name:
fyicenter> \local\jdk-1.8.0\bin\javac JaxbClassInfo.java fyicenter> \local\jdk-1.8.0\bin\java JaxbClassInfo JAXB Implementation Classes: JAXBContext: class com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl Marshaller: class com.sun.xml.internal.bind.v2.runtime.MarshallerImpl
Â
⇒ MyUserObject.java - Create Object from Data Type Class
⇠XJC -p Option for Class Package Name
⇑ Examples for JAXB (Java Architecture for XML Binding)
⇑⇑ FAQ for jaxb-*.jar - Java Architecture for XML Binding
2018-05-08, 770👍, 0💬
Popular Posts:
What Is commons-net-ftp-2.0.jar? commons-net-ftp-2.0.jar is the JAR file for Apache Commons Net FTP ...
What Is junit-3.8.1.jar? junit-3.8.1.jar is the version 3.8.1 of JUnit JAR library file. JUnit is a ...
Guava is a suite of core and expanded libraries that include utility classes, google's collections, ...
kernel.jar is a component in iText Java library to provide low-level functionalities. iText Java lib...
Apache Ant Source Code Files are inside the Apache Ant source package file like apache-ant-1.10.10-s...