-1

I am on Windows 11. I have already setup Windows version of VisualVM and able to perfectly run it without any issues. I wanted to try the Linux flavour. I setup sdkman, java, and maven. But for some reason I am unable to run visualvm successfully.

I think the issue is that libXtst.so is not available in Ubuntu 22. Ubuntu uses all lowercase letters or so I heard. But I am unable to troubleshoot further and fix the problem. I tried all Java 8, 17 and 21. I have even set flags manually: visualvm --jdkhome=/home/ahroo/.sdkman/candidates/java/17.0.9-amzn

I have added version details below.

ahroo@AhrooranR:/mnt/c/Users/AhrooranRavindran$ sdk default java
17.0.9-amzn   21.0.1-amzn   8.0.392-amzn
ahroo@AhrooranR:/mnt/c/Users/AhrooranRavindran$ java -version
openjdk version "21.0.1" 2023-10-17 LTS
OpenJDK Runtime Environment Corretto-21.0.1.12.1 (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Corretto-21.0.1.12.1 (build 21.0.1+12-LTS, mixed mode, sharing)
ahroo@AhrooranR:/mnt/c/Users/AhrooranRavindran$ mvn -v
Apache Maven 3.9.4 (dfbb324ad4a7c8fb0bf182e6d91b0ae20e3d2dd9)
Maven home: /mnt/c/AHROO/programs/apache-maven-3.9.2
Java version: 21.0.1, vendor: Amazon.com Inc., runtime: /home/ahroo/.sdkman/candidates/java/21.0.1-amzn
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.15.133.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"
ahroo@AhrooranR:/mnt/c/Users/AhrooranRavindran$ sdk default visualvm 2.1.7
setting visualvm 2.1.7 as the default version for all shells.
ahroo@AhrooranR:/mnt/c/Users/AhrooranRavindran$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy
ahroo@AhrooranR:/mnt/c/Users/AhrooranRavindran$ visualvm
java.lang.UnsatisfiedLinkError: /home/ahroo/.sdkman/candidates/java/21.0.1-amzn/lib/libawt_xawt.so: libXtst.so.6: cannot open shared object file: No such file or directory
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2418)
        at java.base/java.lang.Runtime.load0(Runtime.java:852)
        at java.base/java.lang.System.load(System.java:2021)
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
        at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:259)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:249)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2427)
        at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:916)
        at java.base/java.lang.System.loadLibrary(System.java:2059)
        at java.desktop/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:67)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
        at java.desktop/sun.awt.X11GraphicsEnvironment.initStatic(X11GraphicsEnvironment.java:64)
        at java.desktop/sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:59)
        at java.desktop/sun.awt.PlatformGraphicsInfo.createGE(PlatformGraphicsInfo.java:37)
        at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:93)
        at java.desktop/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:84)
        at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:106)
        at org.netbeans.core.startup.Main.start(Main.java:245)
        at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:98)
        at java.base/java.lang.Thread.run(Thread.java:1583)

I ran visual with console output. Perhaps this could help:

ahroo@AhrooranR:/mnt/c/Users/AhrooranRavindran$ visualvm -J-Dnetbeans.logger.console=true
java.lang.UnsatisfiedLinkError: /home/ahroo/.sdkman/candidates/java/21.0.1-amzn/lib/libawt_xawt.so: libXtst.so.6: cannot open shared object file: No such file or directory
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2418)
        at java.base/java.lang.Runtime.load0(Runtime.java:852)
        at java.base/java.lang.System.load(System.java:2021)
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
        at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:259)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:249)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2427)
        at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:916)
        at java.base/java.lang.System.loadLibrary(System.java:2059)
        at java.desktop/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:67)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
        at java.desktop/sun.awt.X11GraphicsEnvironment.initStatic(X11GraphicsEnvironment.java:64)
        at java.desktop/sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:59)
        at java.desktop/sun.awt.PlatformGraphicsInfo.createGE(PlatformGraphicsInfo.java:37)
        at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:93)
        at java.desktop/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:84)
        at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:106)
        at org.netbeans.core.startup.Main.start(Main.java:245)
        at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:98)
        at java.base/java.lang.Thread.run(Thread.java:1583)
-------------------------------------------------------------------------------
>Log Session: Sunday, January 7, 2024, 6:02:00 PM India Standard Time
>System Info:
  Product Version         = VisualVM 2.1.7
  Operating System        = Linux version 5.15.133.1-microsoft-standard-WSL2 running on amd64
  Java; VM; Vendor        = 21.0.1; OpenJDK 64-Bit Server VM 21.0.1+12-LTS; Amazon.com Inc.
  Runtime                 = OpenJDK Runtime Environment 21.0.1+12-LTS
  Java Home               = /home/ahroo/.sdkman/candidates/java/21.0.1-amzn
  System Locale; Encoding = en (visualvm); UTF-8
  Home Directory          = /home/ahroo
  Current Directory       = /mnt/c/Users/AhrooranRavindran
  User Directory          = /home/ahroo/.visualvm/2.1.7
  Cache Directory         = /home/ahroo/.cache/visualvm/2.1.7
  Installation            = /home/ahroo/.sdkman/candidates/visualvm/current/visualvm
                            /home/ahroo/.sdkman/candidates/visualvm/current/platform
  Boot & Ext. Classpath   =
  Application Classpath   = /home/ahroo/.sdkman/candidates/visualvm/current/platform/lib/boot.jar:/home/ahroo/.sdkman/candidates/visualvm/current/platform/lib/org-openide-modules.jar:/home/ahroo/.sdkman/candidates/visualvm/current/platform/lib/org-openide-util-lookup.jar:/home/ahroo/.sdkman/candidates/visualvm/current/platform/lib/org-openide-util-ui.jar:/home/ahroo/.sdkman/candidates/visualvm/current/platform/lib/org-openide-util.jar
  Startup Classpath       = /home/ahroo/.sdkman/candidates/visualvm/current/platform/core/org-openide-filesystems.jar:/home/ahroo/.sdkman/candidates/visualvm/current/platform/core/core-base.jar:/home/ahroo/.sdkman/candidates/visualvm/current/platform/core/org-netbeans-libs-asm.jar:/home/ahroo/.sdkman/candidates/visualvm/current/platform/core/core.jar:/home/ahroo/.sdkman/candidates/visualvm/current/platform/core/asm-commons-9.2.jar:/home/ahroo/.sdkman/candidates/visualvm/current/platform/core/asm-tree-9.2.jar:/home/ahroo/.sdkman/candidates/visualvm/current/platform/core/asm-9.2.jar:/home/ahroo/.sdkman/candidates/visualvm/current/visualvm/core/org-graalvm-visualvm-modules-startup.jar:/home/ahroo/.sdkman/candidates/visualvm/current/visualvm/core/locale/core_visualvm.jar
-------------------------------------------------------------------------------

1 Answer 1

0

I think the issue is that libXtst.so is not available in Ubuntu 22.

On a Ubuntu 22.04.3 LTS system, following the suggestion in How do I find the package that provides a file? reports that that libXtst.so is provided by the libxtst6:amd64 package:

$ apt-file find libXtst.so
libxtst-dev: /usr/lib/x86_64-linux-gnu/libXtst.so
libxtst6: /usr/lib/x86_64-linux-gnu/libXtst.so.6
libxtst6: /usr/lib/x86_64-linux-gnu/libXtst.so.6.1.0

Suggest try sudo apt install libxtst6 to install the package, and see if:

  1. That allows visualvm to run.
  2. Or changes the error message to report a different missing dependant shared library. In which case the above example of using apt-file find to search for the package which provides a specific shared library, should allow you to locate and install the package which provides the shared library.

Not the answer you're looking for? Browse other questions tagged or ask your own question.