0

I have a project which builds fine under gradle as well as in the IntelliJ IDE run configuration.

But it gives a problem in the VSCode IDE:

The package javax.crypto is accessible from more than one module

The are no module-info.java file in the entire project.

The modules listed are:

~/Desktop/dev/projects/pid2 % java --list-modules                                                                                                                                                                                                          
java.*
jdk.*

The VSCode home setting for the JDK is:

"java.home": "/Users/stephane.eybert/.sdkman/candidates/java/current",

and it is the version:

~/Desktop/dev/projects/pid2 % /Users/stephane.eybert/.sdkman/candidates/java/current/bin/java -version                                                                                                                                                      (master)pid2
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

I tried with changing the JDK so as to use the same one as IntelliJ is using, but the problem remained the same.

The IntelliJ JDK version is:

~/Desktop % /Applications/IntelliJ\ IDEA.app/Contents/jbr/Contents/Home/bin/java -version
openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+10-b304.77)
OpenJDK 64-Bit Server VM (build 11.0.4+10-b304.77, mixed mode)

The VSCode version is:

Version: 1.40.0
Commit: 86405ea23e3937316009fc27c9361deee66ffbf5
Date: 2019-11-06T17:09:34.601Z
Electron: 6.1.2
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 19.0.0
Stephane
  • 11,836
  • 25
  • 112
  • 175
  • have you add it to the `.classpath` – Leo Zhu Dec 03 '19 at 08:51
  • Sorry I didn't understand your question. You suggest I add what ? – Stephane Dec 03 '19 at 18:28
  • Is there a setting to disable the checking of conflicts between the noname module containing the packages of the CLASSPATH and the packages in the modules of the MODULEPATH ? – Stephane Dec 09 '19 at 11:00
  • I'm sorry for replying to you so late. Is there any progress?Have you tried to unistall and reinstall your jdk ? – Leo Zhu Dec 13 '19 at 05:35
  • Yes I upgraded to the JDK java version `"11.0.5" 2019-10-15 LTS` but the issue remained exactly the same. – Stephane Dec 13 '19 at 11:38
  • Please can you upload a simplified facsimile of your project that has the same issue? There is obviously something going on that is impossible to diagnose with the limited snippets of info you've shared so far. – deduper Dec 16 '19 at 10:39
  • @deduper Yes I was thinking the same, but it's a company project, and I cannot share its source code. The only thing I could do is try to create a project from scratch with a similar generic structure, and see if I can replicate the issue in it. – Stephane Dec 16 '19 at 11:56
  • 1
    Yes. Please? Thanks. Incidentally, „*simplified facsimile*“ is the short way of saying: «*try to create a project from scratch with a similar generic structure, and see if I can replicate the issue in it*» :) – deduper Dec 16 '19 at 12:19
  • Did you ever find a solution? I am experiencing the same exact issue. – retrovius Apr 17 '20 at 18:31
  • 2
    I had left the company and forgot about that issue. I have no longer access to the project. – Stephane Apr 19 '20 at 15:26

1 Answers1

0

For me the issue is on java.util package.

In each java project there will be .settings folder created by vscode, in that folder open org.eclipse.jdt.core.prefs file, change the org.eclipse.jdt.core.compiler.compliance option from 11 to 1.8 and clean workspace

or

Changing the maven-compiler-plugin source and target to 1.8 worked for me.

Both the ways worked for me.

Rishi0405
  • 354
  • 1
  • 11