You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Looking at some other issues I found that there is also a closure-compiler-unshaded version. Searching on Maven I downloaded closure-compiler-unshaded-v20240317.jar
no main manifest attribute, in /path/to/closure-compiler-unshaded-v20240317.jar
If I go back a few versions I can use the v20211201 without error.
What is the difference between closure-compiler and closure-compiler-unshaded?
Why does closure-compiler-v20240317 have a main manifest attribute but closure-compiler-unshaded-v20240317 not?
How to run closure-compiler with JavaRE 8u431?
Fixing the missing main manifest attribute in closure-compiler-unshaded-v20240317 results in a java.lang.ClassNotFoundException exception.
Even going back to 2013 that line, if present in the jar MANIFEST, is
The unshaded jar isn't suitable for running directly via java -jar path/to/closure... - since the jar is not shaded, there are missing dependencies that will be absent when you run this way. Even if you added them and specified the main class, you still could not run on Java 8.
I'm afraid that assumption is wrong - there is no more "JRE" as of Java 9 - instead the JDK (which includes everything in the JRE) is provided and can be used as a JRE. Alternatively, some applications will use the jlink tool to produce a standalone executable, including on the parts of the JDK that the application uses. Typically, this will be a subset of the JRE that was shipped prior to Java 9.
Some older versions of Java continue to be supported by some maintainers - notably, 8, 11, 17, and 21 at this time.
As my link indicates, at this time closure-compiler can run on Java 11+, so you need a version of Java (that is, a JDK) at least that new.
In theory you could run jlink yourself to let the closure-compiler run standalone, but the closure-compiler project does not do that for you. There are however "native" builds of closure-compiler that are available, using Graal - but these must be made per OS/platform, and it is technically possible that your own computer might not have a build appropriate to it. In that case, the tooling that uses these native builds will download the jar file, and will need an appropriate Java version to run it on. See https://github.com/google/closure-compiler-npm/blob/master/packages/google-closure-compiler/README.md for more information on this.
Following the Getting Started with the Closure Compiler Application page I installed Java Version 8 Update 431 (64-bit) for Windows 11. Installed on disk in the confusing directory
C:\Program Files\Java\jre1.8.0_431
Getting the latest
closure-compiler
from Maven repository (closure-compiler-v20240317.jar)Running with
I get the error
Looking at some other issues I found that there is also a
closure-compiler-unshaded
version. Searching on Maven I downloadedclosure-compiler-unshaded-v20240317.jar
Running with
I get the error
If I go back a few versions I can use the
v20211201
without error.What is the difference between
closure-compiler
andclosure-compiler-unshaded
?Why does
closure-compiler-v20240317
have amain manifest attribute
butclosure-compiler-unshaded-v20240317
not?How to run
closure-compiler
with JavaRE 8u431?Fixing the missing
main manifest attribute
inclosure-compiler-unshaded-v20240317
results in ajava.lang.ClassNotFoundException
exception.Even going back to 2013 that line, if present in the jar MANIFEST, is
The text was updated successfully, but these errors were encountered: