What is the replacement for javax.activation package in java 9?
JavaBeans Activation Framework (JAF) is possibly the alternative you are looking for to the existing package.
This standalone release of JAF uses a Java Platform Module System
automatic module name ofjava.activation
, to match the module name
used in JDK 9. A future version will include full module metadata.
The standalone APIs are supported in modular form only, via the concept of upgradeable modules. Using them, it's possible to use a version of that module from a later release in any phase, i.e., at compile time, build time, or runtime.
The currently available version for this is 1.2.0
which can be used like this:
Maven
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>1.2.0</version>
</dependency>
Gradle
compile 'com.sun.activation:javax.activation:1.2.0'
Ivy
<dependency org="com.sun.activation" name="javax.activation" rev="1.2.0" />
Several java 'activation' libraries define overlapping classes. Which one to use?
Finally got it.
JavaBeans activation framework has been moved to Jakarta Activation, see Jakarta JAF page, it means javax.activation:activation
is out of date.
The right one seems to be jakarta activation, thanks to this answer.
Same for emails and XML processing that require the activation JAR - use the Jakarta ones: com.sun.mail:jakarta.mail
and jakarta.xml.bind:jakarta.xml.bind-api
.
Add Java system modules to compile in Eclipse
Complete documentation for these features still needs to be written, but a start has been made in the New & Noteworthy for Photon M3 (work in progress). The functionality you are looking for is mentioned in the paragraph starting with
On the Contents tab individual modules inside a container like JRE System Library can be included or excluded by moving the module from left-to-right or vice versa ...
This dialog tab combines effects of --add-modules
and --limit-modules
.
Edit: In Eclipse 2019-06 the UI mentioned above has been revamped. Up-to-date documentation can be found in the online help.
Replacements for deprecated JPMS modules with Java EE APIs
Instead of using the deprecated Java EE modules, use the following artifacts.
JAF (java.activation)
JavaBeans Activation Framework (now Jakarta Activation) is a standalone technology (available on Maven Central):
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>jakarta.activation</artifactId>
<version>1.2.2</version>
</dependency>
(Source)
CORBA (java.corba)
From JEP 320:
There will not be a standalone version of CORBA unless third parties take over maintenance of the CORBA APIs, ORB implementation, CosNaming provider, etc. Third party maintenance is possible because the Java SE Platform endorses independent implementations of CORBA. In contrast, the API for RMI-IIOP is defined and implemented solely within Java SE. There will not be a standalone version of RMI-IIOP unless a dedicated JSR is started to maintain it, or stewardship of the API is taken over by the Eclipse Foundation (the transition of stewardship of Java EE from the JCP to the Eclipse Foundation includes GlassFish and its implementation of CORBA and RMI-IIOP).
JTA (java.transaction)
Stand alone version:
<dependency>
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
<version>1.3.3</version>
</dependency>
(Source)
JAXB (java.xml.bind)
Since Java EE was rebranded to Jakarta EE, JAXB is now provided by new artifacts:
<!-- API -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.3</version>
</dependency>
<!-- Runtime -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.3</version>
<scope>runtime</scope>
</dependency>
<!-- Alternative runtime -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.3</version>
<scope>runtime</scope>
</dependency>
JAXB Reference Implementation page.
The alternative runtime was brought up by Abhijit Sarkar.
schemagen
and xjc
can be downloaded from there too as part of a standalone JAXB distribution.
See also linked answer.
JAX-WS (java.xml.ws)
Reference implementation:
<!-- API -->
<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
<version>2.3.3</version>
</dependency>
<!-- Runtime -->
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.3</version>
</dependency>
Standalone distribution download (contains wsgen
and wsimport
).
Common Annotations (java.xml.ws.annotation)
Java Commons Annotations (available on Maven Central):
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>1.3.5</version>
</dependency>
(Source)
How to Run XJC in Java 9+
The primary issue was that the java executable doesn't support specifying both the -cp
and -jar
command-line arguments at the same time. Thanks to Alan Bateman for that information!
Therefore, the correct way to get this to work is by using the following command:
java -cp javax.activation-1.2.0.jar;jaxb-xjc.jar com.sun.tools.xjc.XJCFacade
[xjc-arguments]
In order to simplify running XJC, open bin/xjc.bat (extracted from jaxb-ri-2.3.0.zip), and edit the command line to match the above call.
Related Topics
How to Add a Utf-8 Bom in Java
Why Are Getter and Setter Method Important in Java
How Are Integers Cast to Bytes in Java
Getting an Attribute Value in Xml Element
Java: Finding the Highest Value in an Array
Java Operator Precedence Guidelines
(Unknown Source) in Exception Stack Trace
How to Make a Jbutton in a Jtable Cell Click-Able
Jfreechart Candlestick Chart Weird Behaviour on Drag
Nullpointerexception Through Auto-Boxing-Behavior of Java Ternary Operator
How to Make Anonymous Inner Classes in Java Static
How to Get Backspace \B to Work in Eclipse's Console
How to Draw a Tree Representing a Graph of Connected Nodes
Overloading in Java and Multiple Dispatch
How to Use Yamlpropertiesfactorybean to Load Yaml Files Using Spring Framework 4.1