Reputation: 13834
I'm moving a Java Swing app for which I do not have the source from Java 8 to Java 10.
I first ran into:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/ws/WebServiceException
Which I successfully solved. As explained in many posts on SO and other sites, modules have been moved out of the JDK as of Java 9. This means I had to bring back dependencies into my classpath for the app to run.
Now I am getting:
java.lang.NoClassDefFoundError: sun/net/www/protocol/https/DefaultHostnameVerifier
But I cannot seem to find where that dependency is. I found a post which suggested changing code but that is not an option for me. What else can I try?
Upvotes: 2
Views: 1643
Reputation: 44970
sun
package classes were always meant as internal JDK implementation detail and not meant to be used in the application code. Now that JDK was modularized by Project Jigsaw this class is no longer available and that's a good thing. This is not anything new, see Why Developers Should Not Write Programs That Call 'sun' Packages:
The sun.* packages are not part of the supported, public interface. A Java program that directly calls into sun.* packages is not guaranteed to work on all Java-compatible platforms. In fact, such a program is not guaranteed to work even in future versions on the same platform.
The solution is to change your application code to be compatible with JDK 10. If your application code can't be changed it should remain on JDK 8.
Upvotes: 2