标签:style blog http java color 使用
iEMP34:/opt/version/lktest/b030/jre/jre_linux/bin # ./java -classpath . SysInfo Exception in thread "main" java.lang.NoClassDefFoundError: org/hyperic/sigar/SigarException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.getMainMethod(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.hyperic.sigar.SigarException at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 6 more iEMP34:/opt/version/lktest/b030/jre/jre_linux/bin # ./java -classpath "." SysInfo Exception in thread "main" java.lang.NoClassDefFoundError: org/hyperic/sigar/SigarException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.getMainMethod(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.hyperic.sigar.SigarException at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 6 more iEMP34:/opt/version/lktest/b030/jre/jre_linux/bin # ./java -classpath /opt/version/lktest/b030/jre/jre_linux/bin:. SysInfo Exception in thread "main" java.lang.NoClassDefFoundError: org/hyperic/sigar/SigarException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.getMainMethod(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.hyperic.sigar.SigarException at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 6 more iEMP34:/opt/version/lktest/b030/jre/jre_linux/bin # ./java -classpath /opt/version/lktest/b030/jre/jre_linux/bin/sigar.jar:. SysInfo no libsigar-amd64-linux.so in java.library.path org.hyperic.sigar.SigarException: no libsigar-amd64-linux.so in java.library.path at org.hyperic.sigar.Sigar.loadLibrary(Sigar.java:172) at org.hyperic.sigar.Sigar.<clinit>(Sigar.java:100) at SysInfo.getCpuCount(SysInfo.java:39) at SysInfo.main(SysInfo.java:25) Exception in thread "main" java.lang.UnsatisfiedLinkError: org.hyperic.sigar.Sigar.getCpuInfoList()[Lorg/hyperic/sigar/CpuInfo; at org.hyperic.sigar.Sigar.getCpuInfoList(Native Method) at SysInfo.getCpuCount(SysInfo.java:41) at SysInfo.main(SysInfo.java:25) You have new mail in /var/mail/root
必须指定具体jar才行吗?
同时注意-cp 和 classpath 是一个意思
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
这样都不行吗:-classpath /opt/version/lktest/b030/jre/jre_linux/bin/
———— 看来就是必须指定具体jar,而不能是目录!
-D<name>=<value> ----- 这就是相当于设置了system参数,之后可以使用System.getProperty(name)来获取。
set a system property
标签:style blog http java color 使用
原文地址:http://www.cnblogs.com/FlyAway2013/p/3663756.html