Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
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
2018-05-08, ∼1413🔥, 0💬
Popular Posts:
JDK 11 java.rmi.jmod is the JMOD file for JDK 11 RMI (Remote Method Invocation) module. JDK 11 RMI m...
JDK 11 jdk.javadoc.jmod is the JMOD file for JDK 11 Java Document tool, which can be invoked by the ...
JDK 17 java.xml.crypto.jmod is the JMOD file for JDK 17 XML (eXtensible Markup Language) Crypto modu...
A stream buffer is a stream-based representation of an XML infoset in Java. Stream buffers are desig...
How to download and install iText7-Core-7.1.4.zip? iText7-Core-7.1.4.zip is the binary package of iT...