Package javax.sql is accessible from multiple modules: <unnamed>, Understanding How to Avoid java.sql

Asked 1 years ago, Updated 1 years ago, 298 views

The following error occurred when I changed the JDK to JDK8→JDK11 and built it.
I don't know how to avoid this error, but
If anyone knows, could you please let me know?

Error
Package javax.sql is accessible from multiple modules: ,java.sql

Environment
·Windows 10
·Oracle OpenJDK11
·Eclipse 2020

(Supplement)
1)What we know now is
 Adding "j2ee.jar" to the Java build path results in the above error.
 Removing "j2ee.jar" from the Java build path will erase the above error, but
 An error (class not found) occurs in the program using "j2ee.jar".

2) The following actions were performed from Eclipse, but the error was not resolved.
 Right-click the appropriate project → Properties → Java Build Path → Library Tab →
 Set the jar file to be used for the project in the class path.
 (The JRE system library is located in the module path.)

Enter a description of the image here
Thank you for your cooperation.

java eclipse java8

2022-09-30 21:55

1 Answers

This is probably because javax.sql is included in both the class path and the module path.
In this case, both JDK, jee.jar are included.

For example, the following actions can be taken:

  • Remove javax/sql from jee.jar
  • Use a newer one instead of
  • jee.jar.
      I don't know who
    • jee.jar is, for example, javax:javaee-api is, but none of the versions seem to contain javax/sql.
    I don't know who
  • jee.jar is, for example, javax:javaee-api is, but none of the versions seem to contain javax/sql.

Note:


2022-09-30 21:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.