Erick,

> On 29. 1. 2021, at 5:50 PM, Nelson, Erick <erick.nel...@hdsupply.com> wrote:
> On big sur box, is java_home pointing to jre or jdk?

Neither.

I had to duckduckgo “java_home” first; I've never needed the thing before. It 
was empty — both on the Big Sur thing, and also on Catalina (where Groovy 
compiles Java sources perfectly). Based on the page 
https://explainjava.com/set-java-home-mac-os/ I have tried to set it up to what 
 returns, /usr/libexec/java_home which did not work; nevertheless, eventually, 
doing it manually like this

===
89 ocs /tmp> /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    1.8.181.13 (x86_64) "Oracle Corporation" - "Java" /Library/Internet 
Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
    1.8.0_45 (x86_64) "Oracle Corporation" - "Java SE 8" 
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
90 ocs /tmp> export 
JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home"
91 ocs /tmp> /usr/local/groovy-2.4.21/bin/groovyc -j empty.java                 
  
92 ocs /tmp> 
===

seemed to help indeed. Thanks!

Nevertheless, there's no JAVA_HOME at all on my Catalina either, and groovy 
compiles Java in there without a glitch. How comes? And also, is there a way to 
set the thing up properly without fixing the path in my build scripts? The 
java_home thing returns a completely wrong path without the -V switch:

===
1 ocs ~> /usr/libexec/java_home 
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
2 ocs ~> 
===

Thanks a lot,
OC


> 
> On 1/29/21, 8:47 AM, "o...@ocs.cz" <o...@ocs.cz> wrote:
> 
>    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