Fast File IO in Java Part 4 — Running Java Experimental Features
In order to do some fast file processing we need to set up our IDE (Intellij in my case) so that it runs experimental features.
We want to be able to use the https://docs.oracle.com/en%2Fjava%2Fjavase%2F21%2Fdocs%2Fapi%2F%2F/java.base/java/nio/channels/FileChannel.html#map(java.nio.channels.FileChannel.MapMode,long,long,java.lang.foreign.Arena)
That is an experimental Arena feature and usually compilers do not want that. So we need to do some run configuration settings.
There are ways to run experimental features. I have tried updating the compiler options to no avail. Instead I have changed the run configurations in Java run options.
As you see I have added VM options for “enable-preview — source 21” to make java run experimental features.
This is the equivalent of running:
java --enable-preview --source 21 Main.java
You also want to disable building the project before running:
Then it will compile and run and you wont have to do more settings for compiling!
Hope this helps you!