sigar and eclipse [message #726172] |
Fri, 16 September 2011 17:47  |
Eclipse User |
|
|
|
hi,
I'm using sigar for monitoring cpu usage and free ram etc. In eclipse the program works fine. But after I exported it as a jar file and run it from the command line.
Java tells me :
Exception in thread "main" java.lang.NoClassDefFoundError: org/hyperic/sigar/Sig
arException
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
i already tried to run it by setting the classpath to the sigar library:
java -classpath "C:\Users\Thomas\Desktop\hyperic-sigar-1.6.4\sigar-bin\lib\sigar.jar"; -jar testClient.jar
Does anyone know how to export the jar file correctly?
Thomas
|
|
|
|
Re: sigar and eclipse [message #726236 is a reply to message #726232] |
Fri, 16 September 2011 21:15   |
Eclipse User |
|
|
|
I've already tried to set the classpath in the manifest. but it still does not work.
Here's the manifest:
Manifest-Version: 1.0
Class-Path: "C:\Users\Thomas\Desktop\hyperic-sigar-1.6.4\sigar-bin\lib\sigar.jar"
Main-Class: de.server.server.main.testClient
any other suggestion to solve the problem?
|
|
|
Re: sigar and eclipse [message #726283 is a reply to message #726236] |
Sat, 17 September 2011 03:37  |
Eclipse User |
|
|
|
On 09/16/2011 04:15 PM, programsearch wrote:
> I've already tried to set the classpath in the manifest. but it still
> does not work.
>
> Here's the manifest:
>
> Manifest-Version: 1.0
> Class-Path:
> "C:\Users\Thomas\Desktop\hyperic-sigar-1.6.4\sigar-bin\lib\sigar.jar"
> Main-Class: de.server.server.main.testClient
>
> any other suggestion to solve the problem?
Setting the classpath in the manifest is the proper way to do this. If
you are still getting errors, then you must not be configuring the
manifest properly.
Note that this is a general Java question and not specific to Eclipse
JDT tools. You may get more help asking on a Java language specific forum.
|
|
|
Powered by
FUDForum. Page generated in 0.03382 seconds