Cloudflare pages closure compiler

I have a git project with some javascript files that I run through closure compiler before distributing. I am trying to get closure going on the pages build script but it appears that java is too old. I might be able to use an older version but I would rather not. Any other ideas? Could there be multiple java versions installed? Is the build OS/packages documented somewhere?

21:14:05.518	Error: A JNI error has occurred, please check your installation and try again
21:14:05.520	Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/javascript/jscomp/CommandLineRunner 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
21:14:05.520		at java.lang.ClassLoader.defineClass1(Native Method)
21:14:05.520		at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
21:14:05.520		at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
21:14:05.520		at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
21:14:05.520		at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
21:14:05.521		at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
21:14:05.521		at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
21:14:05.521		at java.security.AccessController.doPrivileged(Native Method)
21:14:05.521		at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
21:14:05.521		at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
21:14:05.521		at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
21:14:05.521		at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
21:14:05.521		at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
21:14:05.531	Failed: build command exited with code: 1
21:14:06.568	Failed: an internal error occurred

Update: I did find a list of installed packages

It only has java 8 support so im still looking for a solution

You either need to use direct uploads or wait for build image v2

Using npm to install closure gives a different error
npm i -g google-closure-compiler

21:41:01.603	/opt/buildhome/.nvm/versions/node/v12.18.0/bin/google-closure-compiler
21:41:02.804	/opt/buildhome/.nvm/versions/node/v12.18.0/lib/node_modules/google-closure-compiler/node_modules/google-closure-compiler-linux/compiler: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /opt/buildhome/.nvm/versions/node/v12.18.0/lib/node_modules/google-closure-compiler/node_modules/google-closure-compiler-linux/compiler)
21:41:02.804	/opt/buildhome/.nvm/versions/node/v12.18.0/lib/node_modules/google-closure-compiler/node_modules/google-closure-compiler-linux/compiler: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /opt/buildhome/.nvm/versions/node/v12.18.0/lib/node_modules/google-closure-compiler/node_modules/google-closure-compiler-linux/compiler)
21:41:02.815	Failed: build command exited with code: 1
21:41:04.065	Failed: an internal error occurred

I did upload the java jar
java -jar closure-compiler-v20230103.jar

Is there a way to direct upload java or something else in mind?

You need to run the jar file locally then upload the output of that.

That kind of defeats the purpose of building from github. There has to be something that can be done.

Until page image v2 comes out (Q1 2023) you can only direct upload.

I got it!
Simply getting the newer version of java worked out without any issues

wget https://download.oracle.com/java/19/latest/jdk-19_linux-x64_bin.tar.gz
tar -xzf jdk*.tar.gz
rm jdk*.tar.gz
jdk*/bin/java -jar ...