COMPILATION ERROR package javax.xml.soap does not exist

The issue is that JAX-WS is no longer bundled with Java 11. So if you are running with a newer version of Java you will get compilation error pacakage javax.xml.soap does not exist. It was first flagged as deprecated in Java 9 and in 10 but was removed from Java 11. So to get it work downgrade to use Java 8 instead.



Run your program with Java 8. Source: release notes


If it’s not the Java issue here’s some other troubleshooting you can do. This error occurs when the Java compiler is unable to find the necessary package javax.xml.soap. This package contains classes for working with SOAP (Simple Object Access Protocol) messages.

To resolve this error, you need to ensure that you have the necessary libraries installed and configured properly in your Java development environment. Here are a few steps you can follow to fix this error:

  1. Check that you are using the correct version of Java: Ensure that you are using a version of Java that supports the javax.xml.soap package. This package is available in Java 6 and later versions.
  2. Check that you have the necessary libraries installed: Ensure that you have the necessary libraries installed in your Java development environment. These libraries are usually included in the Java SDK (Software Development Kit), but you may need to install them separately if you are using a third-party Java development environment.
  3. Add the necessary libraries to your classpath: If the necessary libraries are installed but not included in your classpath, you will need to add them to your classpath. You can do this by setting the CLASSPATH environment variable to include the directory containing the necessary libraries.
  4. Check that you have imported the necessary package: Ensure that you have imported the javax.xml.soap package in your Java code. You can do this by adding the following line at the beginning of your Java file:
import javax.xml.soap.*;

By following these steps, you should be able to resolve the “Package javax.xml.soap does not exist” error and successfully compile your Java code.