我有一个远程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转发功能.
但是当我尝试使用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)
我googled那个异常并发现libxtst-dev库丢失了,但我之前安装过它.
那么问题是什么,我怎样才能弄清楚出了什么问题?
更新:
>我在root下工作.
>我在系统中没有其他版本的JDK,使用apt-get purge删除了默认的OpenJDK.
>我的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的版本中,看到接受的答案.
解决方法:
当你用Google搜索异常时,我认为你找到了正确的答案.缺少libXtst.so.6,它应该在/usr/lib目录中.你确定它已经安装好了吗?你可以运行像SwingSet2这样的任何其他Java GUI应用程序吗?你能用-J-Dnetbeans.logger.console = true运行VisualVM并发布输出吗?
jvisualvm -J-Dnetbeans.logger.console=true