I am using windows 11 and wsl as ubuntu. I installed java 8 corretto version and groovy default using sdkman. But using normal ubuntu without wsl I know that writing groovyConsole in the terminal opens an UI where groovy and java codes can be executed. But now while I am doing the same in wsl I am facing the following exception in terminal.
java.lang.reflect.InvocationTargetException
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:115)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:37)
Caused by: java.lang.UnsatisfiedLinkError: /home/aditya_pc/.sdkman/candidates/java/8.0.402-amzn/jre/lib/amd64/libawt_xawt.so: libXtst.so.6: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
at java.lang.Runtime.load0(Runtime.java:782)
at java.lang.System.load(System.java:1100)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1838)
at java.lang.Runtime.loadLibrary0(Runtime.java:843)
at java.lang.System.loadLibrary(System.java:1136)
at java.awt.Toolkit$3.run(Toolkit.java:1636)
at java.awt.Toolkit$3.run(Toolkit.java:1634)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.loadLibraries(Toolkit.java:1633)
at java.awt.Toolkit.<clinit>(Toolkit.java:1670)
at javax.swing.UIManager.getSystemLookAndFeelClassName(UIManager.java:611)
at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
at groovy.console.ui.Console.main(Console.groovy:282)
... 6 more
Asking chatgpt I tried to do the following
export DISPLAY=localhost:0.0
localhost because for me there are chances I may switch my network and ip may change.
But still the same exception persisted, so tried installing libxrender1 as suggested by chatgpt, but still no difference.
sudo apt-get update
sudo apt-get install libxrender1
How to solve the issue so that I can access groovyConsole from wsl using UI as normal linux users do?