So long, Java 8

Or –– how to upgrade your code base from JDK 8 to 11 and beyond.

2 min read


By Sindre Nordbø


December 21, 2019

We've previously covered what's new in JDK 11 and 12, 13 and 14 (part I, part II) and we're hoping you've found some features you want to start using. However, it is not uncommon for huge, critical Java applications to still use JDK 8. It's definitely time to leave JDK 8 behind. I mean, it is over 5 years old, and you're missing out on a lot of good stuff.

While upgrading should be fairly straight forward, if you are using certain parts of the JDK in your code base you'll actually encounter some compile errors. This is because a few packages were removed from Java SE in JDK 11 after being deprecated in JDK 9. Fear not, though, because most of the packages have released as Maven artifacts.

The removed packages are:

  • JAF (java.activation)
  • CORBA (java.corba)
  • JTA (javax.transaction)
  • JAXB (java.xml.bind)
  • JAX-WS (java.xml.ws)
  • Common Annotations (java.xml.ws.annotation)

Replacement Maven artifacts:

JAF (java.activation)

<dependency> <groupId>com.sun.activation</groupId> <artifactId>javax.activation</artifactId> <version>1.2.0</version> </dependency> 

CORBA (java.corba)

In the JEP it is stated that «There will not be a standalone version of CORBA unless third parties take over maintenance of the CORBA APIs, ORB implementation, CosNaming provider, etc.». However, you may have a look at Glassfish CORBA ORB. According to the website it «[…] complies with the CORBA 2.3.1 specification, and with the CORBA 3.0 specifications for the Interoperable Name Service and Portable Interceptors. It includes both IDL and RMI-IIOP support».

JTA (javax.transaction)

<dependency> <groupId>javax.transaction</groupId> <artifactId>javax.transaction-api</artifactId> <version>1.3</version> </dependency> 

JAXB (java.xml.bind)

<dependency> <groupId>jakarta.xml.bind</groupId> <artifactId>jakarta.xml.bind-api</artifactId> <version>2.3.2</version> </dependency> <dependency> <groupId>org.glassfish.jaxb</groupId> <artifactId>jaxb-runtime</artifactId> <version>2.3.2</version> </dependency> 

JAX-WS (java.xml.ws)

<dependency> <groupId>jakarta.xml.ws</groupId> <artifactId>jakarta.xml.ws-api</artifactId> <version>2.3.2</version> </dependency> <dependency> <groupId>com.sun.xml.ws</groupId> <artifactId>jaxws-rt</artifactId> <version>2.3.2</version> </dependency> 

Common Annotations (java.xml.ws.annotation)

<dependency> <groupId>jakarta.annotation</groupId> <artifactId>jakarta.annotation-api</artifactId> <version>1.3.5</version> </dependency> 

💡 The version numbers above are the newest versions as of December 21st 2019. Make sure to verify you're using the newest version, and keep them them updated, by using e.g. maven-dependency-plugin.