So I have downloaded JDK 15 - OpenJDK.
Running in Intelij the following code
import jdk.incubator.foreign.MemorySegment; //The problem seems to occur here in this import
public class Application {
public static void main(String[] args){
MemorySegment m = MemorySegment.allocateNative(400L);
}
}
In inteliJ I have gone to File -> Project Structure -> Project SDK -> selected 15
In Application configurations (Intelij run project) I have declared JRE 15 (java version 15.0.2)
I receive the following error
C:\Users\repositories\java15project\src\main\untitled\src\Application.java:2:21
java: package jdk.incubator.foreign is not visible
(package jdk.incubator.foreign is declared in module jdk.incubator.foreign, which is not in the module graph)
Could someone please help me?
Run with option --add-modules jdk.incubator.foreign
Alternatively, create a module-info.java
file, eg like this:
module my.module.name.here {
requires jdk.incubator.foreign;
}
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.