Hi there,

I've got a project which uses both Groovy and Java sources. After Big Sur 
update -- without touching the project, it remained unchanged and does build 
perfectly on my other machine with a Catalina -- it reports “unable to locate 
the java compiler com.sun.tools.javac.Main, please change your classloader 
settings” and fails.

I have absolutely no idea why and how should I “change my classloader settings” 
in this case? The project never changed, only the environment has (from 
Catalina to Big Sur), and it broke something :(

Any idea what's the culprit and how to fix it?

Thanks a lot!
OC

P.S. Here are details of the fail, it's very easy to repeat on the Big Sur 
machine:

===
69 ocs /tmp> touch empty.java                    
70 ocs /tmp> /usr/local/groovy-2.4.21/bin/groovyc -j empty.java  
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during semantic analysis: unable to locate the java compiler 
com.sun.tools.javac.Main, please change your classloader settings

java.lang.ClassNotFoundException: unable to locate the java compiler 
com.sun.tools.javac.Main, please change your classloader settings
        at 
org.codehaus.groovy.tools.javac.JavacJavaCompiler.findJavac(JavacJavaCompiler.java:193)
        at 
org.codehaus.groovy.tools.javac.JavacJavaCompiler.compile(JavacJavaCompiler.java:53)
        at 
org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit.gotoPhase(JavaAwareCompilationUnit.java:110)
        at 
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:589)
        at 
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
        at 
org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:71)
        at 
org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:227)
        at 
org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:160)
        at 
org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:190)
        at 
org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:174)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:116)
        at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:138)

1 error

71 ocs /tmp> java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
72 ocs /tmp> sw_vers    
ProductName:    macOS
ProductVersion: 11.1
BuildVersion:   20C69
73 ocs /tmp> 
===

Perhaps worth mentioning a newer Groovy fails too, only with _considerably_ 
less friendly error report (bloody NPE is the worst thing ever):

===
73 ocs /tmp> /usr/local/groovy-3.0.4/bin/groovyc -j empty.java 
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during semantic analysis: java.lang.NullPointerException

java.lang.NullPointerException
        at 
org.codehaus.groovy.tools.javac.JavacJavaCompiler.doCompileWithSystemJavaCompiler(JavacJavaCompiler.java:95)
        at 
org.codehaus.groovy.tools.javac.JavacJavaCompiler.compile(JavacJavaCompiler.java:66)
        at 
org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit.gotoPhase(JavaAwareCompilationUnit.java:119)
        at 
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:638)
        at 
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:606)
        at 
org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:311)
        at 
org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:240)
        at 
org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:165)
        at 
org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:205)
        at 
org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:189)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:111)
        at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:129)

1 error

74 ocs /tmp> 
===


Reply via email to