I'm trying to test the virtual threads reference loom project in Java and I'm using the following JDK 19-loom version:
package com;
import java.util.concurrent.ThreadFactory;
public class a {
public static void main (String [] args) throws Exception{
Runnable printThread = () -> System.out.println(Thread.currentThread());
ThreadFactory virtualThreadFactory = Thread.builder().virtual().factory();
ThreadFactory kernelThreadFactory = Thread.builder().factory();
Thread virtualThread = virtualThreadFactory.newThread(printThread);
Thread kernelThread = kernelThreadFactory.newThread(printThread);
virtualThread.start();
kernelThread.start();
}
}
And I have the following IntelliJ configuration:
But I am having the following error:
And it seems that the builder of the thread is not identified
I would like to know what else do I need?