Processing4 : Exported apps on Mac fail to launch because of Java errors

Using Processing4 (v4.0a3), I have trouble running exported applications on Mac (Catalina).
It worked fine with Processing3.

When I launch the exported app, it just exits right away.
When I try to launch the app using the executable inside the app package, I get more meaningful logs, listed below.

When I have java8 installed, I get this error :

MBP-Antoine-2020:~ antoine$ /Users/antoine/Documents/Artworks/BlackSquare/dev/Test/TestP4/application.macosx/TestP4.app/Contents/MacOS/TestP4 ; exit;
2021-06-03 16:19:51.292 TestP4[47541:2601496] NSString *findJavaDylib(NSString *, _Bool, _Bool, _Bool, _Bool) Searching for a JRE.
2021-06-03 16:19:51.356 TestP4[47541:2601496] int launch(char *, int, char **) Launchpath: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib
2021-06-03 16:19:51.375 TestP4[47541:2601545] NSString *findJavaDylib(NSString *, _Bool, _Bool, _Bool, _Bool) Searching for a JRE.
2021-06-03 16:19:51.440 TestP4[47541:2601545] int launch(char *, int, char **) Launchpath: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib
Error: A JNI error has occurred, please check your installation and try again
Exception in thread “main” java.lang.UnsupportedClassVersionError: TestP4 has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)

When I install JRE 11, I get this error :

/Users/antoine/Documents/Artworks/BlackSquare/dev/Test/TestP4/application.macosx/TestP4.app/Contents/MacOS/TestP4 ; exit;
2021-06-03 16:02:38.772 TestP4[46938:2588137] NSString *findJavaDylib(NSString *, _Bool, _Bool, _Bool, _Bool) Searching for a JRE.
2021-06-03 16:02:38.772 TestP4[46938:2588137] NSString *findJREDylib(int, _Bool, _Bool) JRE search exception: ‘launch path not accessible’
2021-06-03 16:02:38.837 TestP4[46938:2588137] int launch(char *, int, char **) Launchpath: /Library/Java/JavaVirtualMachines/jdk-11.0.11.jdk/Contents/Home/lib/jli/libjli.dylib
2021-06-03 16:02:38.862 TestP4[46938:2588148] NSString *findJavaDylib(NSString *, _Bool, _Bool, _Bool, _Bool) Searching for a JRE.
2021-06-03 16:02:38.862 TestP4[46938:2588148] NSString *findJREDylib(int, _Bool, _Bool) JRE search exception: ‘launch path not accessible’
2021-06-03 16:02:38.875 TestP4[46938:2588148] int launch(char *, int, char **) Launchpath: /Library/Java/JavaVirtualMachines/jdk-11.0.11.jdk/Contents/Home/lib/jli/libjli.dylib
java.lang.RuntimeException: java.lang.ClassNotFoundException: --full-screen
at processing.core.PApplet.runSketch(PApplet.java:10712)
at processing.core.PApplet.main(PApplet.java:10518)
at TestP4.main(TestP4.java:38)
Caused by: java.lang.ClassNotFoundException: --full-screen
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at processing.core.PApplet.runSketch(PApplet.java:10705)

This is a minimal app:
void setup() {
fullScreen(P3D);
frameRate(60);
}

void draw() {
background(0);
fill(255);
rect(100, 100, 200, 200);
}

There seems to be some issues with Java version, but I don’t understand what is happening.

Thanks for any help !

For whatever it’s worth, my Big Sur system is using java 16.0.1.