6

我有一个远程 Debian Squeeze 服务器。我已经手动安装了 Oracle JDK ,并为路径1.7.0_07中的每个二进制文件配置了替代方案。jdk/bin我还导出了全局 JAVA_HOME 变量。

# java -version
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) Server VM (build 23.3-b01, mixed mode)
#

服务器上安装了 Gnome,我正在使用 putty 连接并X-Windows forwarding启用。但是当我尝试使用jvisualvm命令启动 VisualVM 时,我在 5-10 秒的暂停中什么也得不到:

# jvisualvm
#

当我尝试提供帮助时,我看到一个异常:

# jvisualvm --help
Usage: /usr/java/jdk1.7.0_07/bin/../lib/visualvm//platform/lib/nbexec {options} arguments

General options:
  --help                show this help
  --jdkhome <path>      path to Java(TM) 2 SDK, Standard Edition
  -J<jvm_option>        pass <jvm_option> to JVM

  --cp:p <classpath>    prepend <classpath> to classpath
  --cp:a <classpath>    append <classpath> to classpath
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.netbeans.core.startup.Splash$SplashComponent
        at org.netbeans.core.startup.Splash.<init>(Splash.java:111)
        at org.netbeans.core.startup.Splash.getInstance(Splash.java:64)
        at org.netbeans.core.startup.Main.setStatusText(Main.java:47)
        at org.netbeans.core.startup.NbEvents.setStatusText(NbEvents.java:384)
        at org.netbeans.core.startup.NbEvents.logged(NbEvents.java:159)
        at org.netbeans.Events.log(Events.java:127)
        at org.netbeans.core.startup.ModuleList.readInitial(ModuleList.java:129)
        at org.netbeans.core.startup.ModuleSystem.readList(ModuleSystem.java:241)
        at org.netbeans.core.startup.CLICoreBridge.usage(CLICoreBridge.java:69)
        at org.netbeans.CLIHandler.showHelp(CLIHandler.java:125)
        at org.netbeans.CLIHandler.checkHelp(CLIHandler.java:179)
        at org.netbeans.CLIHandler.initialize(CLIHandler.java:530)
        at org.netbeans.CLIHandler.initialize(CLIHandler.java:346)
        at org.netbeans.MainImpl.execute(MainImpl.java:151)
        at org.netbeans.MainImpl.main(MainImpl.java:46)
        at org.netbeans.Main.main(Main.java:39)

我用谷歌搜索了那个异常,发现该libxtst-dev库丢失了,但我之前安装了它。

那么问题是什么,我怎样才能弄清楚出了什么问题?

更新:

  • 我在根目录下工作。
  • 我系统中没有其他版本的 JDK,默认的 OpenJDK 被删除了apt-get purge.
  • 我的CLASSPATH系统变量是空的,有问题吗?

UPDATE2: libXtst/usr/lib

root@test:/usr/lib# ls -la /usr/lib | grep libXtst
-rw-r--r--   1 root root    26666 Июн 23  2010 libXtst.a
lrwxrwxrwx   1 root root       16 Окт  7 01:18 libXtst.so -> libXtst.so.6.1.0
lrwxrwxrwx   1 root root       16 Окт  6 20:26 libXtst.so.6 -> libXtst.so.6.1.0
-rw-r--r--   1 root root    23616 Июн 23  2010 libXtst.so.6.1.0

libXext也在/usr/lib

root@test:~# ls -la /usr/lib | grep libXext
-rw-r--r--   1 root root   118668 Июл 11  2010 libXext.a
lrwxrwxrwx   1 root root       16 Окт  6 22:26 libXext.so -> libXext.so.6.4.0
lrwxrwxrwx   1 root root       16 Май 21 13:42 libXext.so.6 -> libXext.so.6.4.0
-rw-r--r--   1 root root    74432 Июл 11  2010 libXext.so.6.4.0
root@test:~#

这是命令的输出jvisualvm -J-Dnetbeans.logger.console=true

root@test:~# jvisualvm -J-Dnetbeans.logger.console=true
-------------------------------------------------------------------------------
>Log Session: Monday, October 8, 2012 10:48:32 PM MSK
>System Info:
  Product Version         = Java VisualVM
  Operating System        = Linux version 2.6.32-5-amd64 running on i386
  Java; VM; Vendor        = 1.7.0_07; Java HotSpot(TM) Client VM 23.3-b01; Oracle Corporation
  Runtime                 = Java(TM) SE Runtime Environment 1.7.0_07-b10
  Java Home               = /usr/java/jdk1.7.0_07/jre
  System Locale; Encoding = ru_RU (visualvm); UTF-8
  Home Directory          = /root
  Current Directory       = /root
  User Directory          = /root/.visualvm/7u6
  Cache Directory         = /root/.visualvm/7u6/var/cache
  Installation            = /usr/java/jdk1.7.0_07/lib/visualvm/visualvm
                            /usr/java/jdk1.7.0_07/lib/visualvm/profiler
                            /usr/java/jdk1.7.0_07/lib/visualvm/platform
  Boot & Ext. Classpath   = /usr/java/jdk1.7.0_07/jre/lib/resources.jar:/usr/java/jdk1.7.0_07/jre/lib/rt.jar:/usr/java/jdk1.7.0_07/jre/lib/sunrsasign.jar:/usr/java/jdk1.7.0_07/jre/lib/jsse.jar:/usr/java/jdk1.7.0_07/jre/lib/jce.jar:/usr/java/jdk1.7.0_07/jre/lib/charsets.jar:/usr/java/jdk1.7.0_07/jre/lib/jfr.jar:/usr/java/jdk1.7.0_07/jre/classes:/usr/java/jdk1.7.0_07/jre/lib/ext/zipfs.jar:/usr/java/jdk1.7.0_07/jre/lib/ext/dnsns.jar:/usr/java/jdk1.7.0_07/jre/lib/ext/localedata.jar:/usr/java/jdk1.7.0_07/jre/lib/ext/sunpkcs11.jar:/usr/java/jdk1.7.0_07/jre/lib/ext/sunec.jar:/usr/java/jdk1.7.0_07/jre/lib/ext/sunjce_provider.jar
  Application Classpath   = /usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/boot.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/org-openide-modules.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/org-openide-util.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/org-openide-util-lookup.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/boot_ja.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/boot_zh_CN.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/org-openide-modules_ja.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/org-openide-modules_zh_CN.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/org-openide-util_ja.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/org-openide-util-lookup_ja.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/org-openide-util-lookup_zh_CN.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/org-openide-util_zh_CN.jar:/usr/java/jdk1.7.0_07/lib/dt.jar:/usr/java/jdk1.7.0_07/lib/tools.jar
  Startup Classpath       = /usr/java/jdk1.7.0_07/lib/visualvm/platform/core/org-openide-filesystems.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/core/core.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/core/locale/core_ja.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/core/locale/org-openide-filesystems_ja.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/core/locale/core_zh_CN.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/core/locale/org-openide-filesystems_zh_CN.jar:/usr/java/jdk1.7.0_07/bin/../lib/visualvm/visualvm/core/com-sun-tools-visualvm-modules-startup.jar:/usr/java/jdk1.7.0_07/bin/../lib/visualvm/visualvm/core/locale/com-sun-tools-visualvm-modules-startup_ja.jar:/usr/java/jdk1.7.0_07/bin/../lib/visualvm/visualvm/core/locale/core_visualvm.jar:/usr/java/jdk1.7.0_07/bin/../lib/visualvm/visualvm/core/locale/com-sun-tools-visualvm-modules-startup_zh_CN.jar
-------------------------------------------------------------------------------
java.lang.UnsatisfiedLinkError: /usr/java/jdk1.7.0_07/jre/lib/i386/xawt/libmawt.so: libXext.so.6: Unable to open shared object file: No such file or directory
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
        at java.lang.Runtime.load0(Runtime.java:792)
        at java.lang.System.load(System.java:1059)
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1846)
        at java.lang.Runtime.loadLibrary0(Runtime.java:845)
        at java.lang.System.loadLibrary(System.java:1084)
        at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:77)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:102)
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
        at org.netbeans.core.startup.Main.start(Main.java:203)
        at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:84)
        at java.lang.Thread.run(Thread.java:722)

更新 3 我下载了 Java 演示并尝试启动 SwingSet2:

root@test:/tmp/jdk1.7.0_06# java -jar demo/jfc/SwingSet2/SwingSet2.jar
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/java/jdk1.7.0_07/jre/lib/i386/xawt/libmawt.so: libXext.so.6: unbale to open shared object file: no such file or directory
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
        at java.lang.Runtime.load0(Runtime.java:792)
        at java.lang.System.load(System.java:1059)
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1846)
        at java.lang.Runtime.loadLibrary0(Runtime.java:845)
        at java.lang.System.loadLibrary(System.java:1084)
        at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:67)
        at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:47)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Toolkit.loadLibraries(Toolkit.java:1648)
        at java.awt.Toolkit.<clinit>(Toolkit.java:1670)
        at java.awt.Component.<clinit>(Component.java:595)

更新 4

最后我的错误是在 JDK 的版本中,请参阅接受的答案。

4

2 回答 2

6

我认为您在搜索异常时找到了正确的答案。缺少 libXtst.so.6,它应该在 /usr/lib 目录中。你确定它已经安装了吗?您可以运行任何其他 Java GUI 应用程序,例如 SwingSet2 吗?您可以使用 -J-Dnetbeans.logger.console=true 运行 VisualVM 并发布输出吗?

jvisualvm -J-Dnetbeans.logger.console=true
于 2012-10-08T09:30:28.810 回答
1

MAC 的解决方案:[在我的情况下,当我尝试打开应用程序时没有发生任何事情]

转到应用程序文件夹,显示内容 -> 资源/visualvm/etc/visualvm.conf

例子:

/Applications/VisualVM.app/Contents/Resources/visualvm/etc/visualvm.conf

取消注释“visualvm_jdkhome”并将该值替换为正确的 JDK 主路径。

例子:

visualvm_jdkhome="/Users/username/tools/jdk-11.0.10.jdk/Contents/Home"

尝试再次打开应用程序,它应该打开。

于 2021-02-23T18:03:09.580 回答