Apache Spark “cannot access class sun.nio.ch.DirectBuffer” error with Java 15 or higher : add Java VM option --add-exports java.base/sun.nio.ch=ALL-UNNAMED If you are getting this error with Intellij then add it to java vm option (select from Modify Option) list.