简体   繁体   中英

"Package javax.xml.ws does not exist"

I am rusty on Java and completely new to IntelliJ IDEA, an IDE which has been causing a lot of problems for me so far. I am trying to run a program with the line "import javax.xml.ws.Response;". However, I get the error message "package javax.xml.ws does not exist."

I've tried to select the "Add Java EE 6 JARs to module dependencies" automated solution by IntelliJ IDEA, but it doesn't seem to do anything.

(I believe I am running Java 11, if it makes any difference at all. According to the readme by the author of the code, I should be running Java 8, but so far I haven't been able to because I get an unrelated error when trying to change Java versions with IntelliJ.)

What do I do? Thanks in advance.

Your issue is not related to Java version. It will work for both version 8 and 11.

You will need to either download the jaxws-api jar or add it as a Maven dependency accordingly.

You may download the Jar from the below maven repository URL, and then add it to your build path, or update your pom.xml with this dependency:https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api/2.3.1

This is intermittent issue and can eat up hours. Try to do below steps

  1. Remove all dependencies from classpath.
  2. Close the project and open it again.
  3. Add all required dependencies.
  4. Clean your project.

Go to Project Structure and change Project SDK to Java 1.8 solved my problem

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM