6

I used to send emails with javamail and Java 8.

Now that I upgraded to Java 12 I get the java.lang.NoClassDefFoundError: javax/activation/DataHandler.

I added the javax.activation-api-1.2.0.jar and now I get java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport.

This is because javax.activation-api-1.2.0.jar doesn't have the com.sun... package that previous versions had.

What jars should I put on my project to properly send and email with java 12? And where to find them?

There are a lot of confusing sources like:

https://repo1.maven.org/maven2/javax/activation/javax.activation-api/1.2.0/

https://eclipse-ee4j.github.io/jaf/

https://www.oracle.com/java/technologies/java-archive-downloads-java-plat-downloads.html#jaf-1.1.1-fcs-oth-JPR

Gustavo
  • 1,332
  • 2
  • 16
  • 39

1 Answers1

4

You need the implementation jar file, not the API jar file. Use this.

Bill Shannon
  • 29,579
  • 6
  • 38
  • 40
  • There is no attachment. Jakarta mail/activation is equivalent to java mail and java activation framework? – Gustavo Sep 24 '19 at 11:41
  • Sorry, editing error, fixed above. The Jakarta version is identical to the javax version, and you can find it [here](https://search.maven.org/artifact/com.sun.activation/jakarta.activation/1.2.1/jar). – Bill Shannon Sep 24 '19 at 20:09