java.lang.IllegalAccessException: module java.base does not open java.nio to unnamed module @1817d444

I'm following this guide: Windows installation - Operations Manual. When I Invoke-Neo4j console it has an error:

PS D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\bin\Neo4j-Management> invoke-neo4j console
Directories in use:
home:         D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5
config:       D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\conf
logs:         D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\logs
plugins:      D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\plugins
import:       D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\import
data:         D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\data
certificates: D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\certificates
licenses:     D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\licenses
run:          D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\run
Starting Neo4j.
WARNING! You are using an unsupported Java runtime.
* Please use Oracle(R) Java(TM) 11, OpenJDK(TM) 11 to run Neo4j.
* Please see https://neo4j.com/docs/ for Neo4j installation instructions.
Java HotSpot(TM) 64-Bit Server VM warning: Option UseBiasedLocking was deprecated in version 15.0 and will likely be removed in a future release.
2021-10-04 17:25:47.419+0000 INFO  Starting...
Exception in thread "main" java.lang.LinkageError: Cannot to link java.nio.DirectByteBuffer
        at org.neo4j.internal.unsafe.UnsafeUtil.<clinit>(UnsafeUtil.java:124)
        at org.neo4j.memory.RuntimeInternals.guessHeaderSize(RuntimeInternals.java:158)
        at org.neo4j.memory.RuntimeInternals.<clinit>(RuntimeInternals.java:53)
        at org.neo4j.memory.HeapEstimator.<clinit>(HeapEstimator.java:103)
        at org.neo4j.internal.collector.RecentQueryBuffer.<clinit>(RecentQueryBuffer.java:37)
        at org.neo4j.graphdb.factory.module.GlobalModule.<init>(GlobalModule.java:211)
        at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.createGlobalModule(DatabaseManagementServiceFactory.java:259)
        at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.build(DatabaseManagementServiceFactory.java:126)
        at org.neo4j.server.CommunityBootstrapper.createNeo(CommunityBootstrapper.java:36)
        at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:134)
        at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:90)
        at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:34)
Caused by: java.lang.IllegalAccessException: module java.base does not open java.nio to unnamed module @1817d444
        at java.base/java.lang.invoke.MethodHandles.privateLookupIn(MethodHandles.java:259)
        at org.neo4j.internal.unsafe.UnsafeUtil.<clinit>(UnsafeUtil.java:107)
        ... 11 more
2021-10-04 17:25:47.985+0000 INFO  Neo4j Server shutdown initiated by request
2021-10-04 17:25:47.986+0000 INFO  Stopped.
Unexpected process failure. See log for info.
Run with '--verbose' for a more detailed error message.

Verbose version

PS D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\bin\Neo4j-Management> invoke-neo4j console --verbose
Executing command line: powershell.exe -OutputFormat Text -ExecutionPolicy Bypass -Command Get-Service neo4j | Format-Table -AutoSize
Directories in use:
home:         D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5
config:       D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\conf
logs:         D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\logs
plugins:      D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\plugins
import:       D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\import
data:         D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\data
certificates: D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\certificates
licenses:     D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\licenses
run:          D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\run
Starting Neo4j.
WARNING! You are using an unsupported Java runtime.
* Please use Oracle(R) Java(TM) 11, OpenJDK(TM) 11 to run Neo4j.
* Please see https://neo4j.com/docs/ for Neo4j installation instructions.
Executing command line: C:\Program Files\Java\jdk-17\bin\java.exe -cp D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\plugins\*;D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\conf\*;D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\lib\* -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields -XX:+DisableExplicitGC -XX:MaxInlineLevel=15 -XX:-UseBiasedLocking -Djdk.nio.maxCachedBufferSize=262144 -Dio.netty.tryReflectionSetAccessible=true -Djdk.tls.ephemeralDHKeySize=2048 -Djdk.tls.rejectClientInitiatedRenegotiation=true -XX:FlightRecorderOptions=stackdepth=256 -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints -Dlog4j2.disable.jmx=true -Dfile.encoding=UTF-8 org.neo4j.server.CommunityEntryPoint --home-dir=D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5 --config-dir=D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\conf
Java HotSpot(TM) 64-Bit Server VM warning: Option UseBiasedLocking was deprecated in version 15.0 and will likely be removed in a future release.
2021-10-04 17:27:10.040+0000 INFO  Starting...
Exception in thread "main" java.lang.LinkageError: Cannot to link java.nio.DirectByteBuffer
        at org.neo4j.internal.unsafe.UnsafeUtil.<clinit>(UnsafeUtil.java:124)
        at org.neo4j.memory.RuntimeInternals.guessHeaderSize(RuntimeInternals.java:158)
        at org.neo4j.memory.RuntimeInternals.<clinit>(RuntimeInternals.java:53)
        at org.neo4j.memory.HeapEstimator.<clinit>(HeapEstimator.java:103)
        at org.neo4j.internal.collector.RecentQueryBuffer.<clinit>(RecentQueryBuffer.java:37)
        at org.neo4j.graphdb.factory.module.GlobalModule.<init>(GlobalModule.java:211)
        at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.createGlobalModule(DatabaseManagementServiceFactory.java:259)
        at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.build(DatabaseManagementServiceFactory.java:126)
        at org.neo4j.server.CommunityBootstrapper.createNeo(CommunityBootstrapper.java:36)
        at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:134)
        at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:90)
        at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:34)
Caused by: java.lang.IllegalAccessException: module java.base does not open java.nio to unnamed module @1817d444
        at java.base/java.lang.invoke.MethodHandles.privateLookupIn(MethodHandles.java:259)
        at org.neo4j.internal.unsafe.UnsafeUtil.<clinit>(UnsafeUtil.java:107)
        ... 11 more
2021-10-04 17:27:10.448+0000 INFO  Neo4j Server shutdown initiated by request
2021-10-04 17:27:10.448+0000 INFO  Stopped.
org.neo4j.server.startup.BootProcessFailureException: Unexpected process failure. See log for info.
        at org.neo4j.server.startup.ProcessManager.run(ProcessManager.java:189)
        at org.neo4j.server.startup.BootloaderOsAbstraction.console(BootloaderOsAbstraction.java:71)
        at org.neo4j.server.startup.Bootloader.console(Bootloader.java:143)
        at org.neo4j.server.startup.Neo4jCommand$Console.call(Neo4jCommand.java:56)
        at org.neo4j.server.startup.Neo4jCommand$Console.call(Neo4jCommand.java:47)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at org.neo4j.server.startup.Neo4jCommand.main(Neo4jCommand.java:166)
1

Java version

PS D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\bin\Neo4j-Management> java -version
java version "17" 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)
PS D:\Downloads\neo4j-community-4.3.5-windows\neo4j-community-4.3.5\bin\Neo4j-Management>

How should I fix this?

As the logs indicate:

WARNING! You are using an unsupported Java runtime.
* Please use Oracle(R) Java(TM) 11, OpenJDK(TM) 11 to run Neo4j.

Use a JDK 11, not JDK 17.

Thanks. I follow this guide How to downgrade JDK? and it works.

May I ask why we don't support newer version of it?

Hi ganuongphap

You have to uninstall previous java version completely and install a new version.
After that you have to set the $PATH and $JAVA_HOME (User Variables) Environment variable to point to new installation directory.

Thanking you
Sameer Sudhir Gijare

Why does changing the path not suffice? The only place I can get JDK 11 is Java Platform, Standard Edition 11 Reference Implementations, which only provides the binaries, not a setup

Because changing the path only just changes the installation directory of JDK and not JRE. Your runtime environment is still pointing to the old JRE which your browser program is using behind the scenes.

Thanking you
Sudhir & Sameer G

I see. So does that mean Neo4j Browser wouldn't work? Or just regular browsers like Chrome or Firefox? Because if it's the latter, then how is it relevant to Neo4j?

I just mean to say that one needs to have a compatible jre version installed on the browsing machine. Please have a look at system compatibility documents to gain more insights
Thanks
Sameer

Hi @Ooker, there is no need to uninstall the previous (or) any version of Java at all. Since you are using windows, set the appropriate java version in the PATH or environmental variable.

refer to this article -> How to change Java versions in Windows (updated for JDK 17)