mavenconcurrencyjava-19

How can I run JDK 19 with Structured Concurrency? (ERROR: java.lang.NoClassDefFoundError: jdk/incubator/concurrent/StructuredTaskScope)


Note: this post somehow related with this question; however, the error is different. So I am posting as another question.

I also tried adding '=' character, but no luck: java -jar target/com.tugalsan.tst.thread-1.0-SNAPSHOT-jar-with-dependencies.jar --enable-preview --add-modules=jdk.incubator.concurrent


Solution

  • As Joachim Sauer answered:

    Everything after the -jar filename.jar will be passed as an argument. Hence to run an app with jdk.incubator.concurrent, one should use below order:

    java --enable-preview --add-modules jdk.incubator.concurrent -jar JARFILENAME.jar argument0 argument1 argument2...