I created project A with package name "A"
I created another project called "B"
Properties->Java Build Path->Modulepath
added "A"
project B has a source file with "import A" statement
I get "The package A is not accessible"
Option 1: You have the package or the project A stored into another folder. Option 2: You've deleted A or any content related with A so it's not there anymore
That you have added the project to the modulepath and not to the classpath means that you are using Java Platform Module System ( JPMS ) : each of the two projects contains the file module-info.java
in the default package .
You have two options:
module-info.java
files do the following:
module-info.java
of project A add for each exported package a line exports <package-to-export>;
module-info.java
of project A add the line requires <project-A-module-name>;
module-info.java
files (in most cases this is the recommended solution)
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.