I am running groovysh
(groovy 4.0.8 which is installed by sdkman
) on my Mac M1, and it raises a warning:
ansi will be disabled because an error occurred while installing ansi: Could not load library. Reasons: [no jansi in java.library.path: .... tried: '/private/var/folders/ck/2qcbfbs56075y7vsv6_yg6sr0000gn/T/libjansi-64-7439658586757684124.jnilib' (fat file, but missing compatible architecture (have 'x86_64,i386', need 'arm64')
It seems that it downloads a non-arm64 library. How to solve it?
Update: I find that it works if I specify jansi-2.4.0.jar
in the classpath:
groovysh -cp /Users/xxx/.sdkman/candidates/groovy/4.0.8/lib/jansi-2.4.0.jar
It seems that groovysh
's classpath does not contain the packages in lib
.
I conducted the same installation steps on my Manjaro, and groovysh
alone works well without specifying the jansi-2.4.0.jar
. So, what did I miss on Mac M1? Is it a bug of groovysh or jansi?
To enable ANSI color support in Groovy's groovysh on a Mac with ARM architecture, you have to add
export CLASSPATH=$CLASSPATH:~/.sdkman/candidates/groovy/current/lib/jansi-x.x.x.jar
to~/.zshrc
or~/.bashrc
(depending on your shell). Once you have done editing the file runsource ~/.zshrc
orsource ~/.bashrc
to apply the change.