Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » sigar and eclipse
sigar and eclipse [message #726172] Fri, 16 September 2011 17:47 Go to next message
programsearch is currently offline programsearchFriend
Messages: 2
Registered: September 2011
Junior Member
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 #726232 is a reply to message #726172] Fri, 16 September 2011 20:47 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
-classpath is ignored when -jar is used. You have to update the manifest of the jar file to include the extra jar.
Re: sigar and eclipse [message #726236 is a reply to message #726232] Fri, 16 September 2011 21:15 Go to previous messageGo to next message
programsearch is currently offline programsearchFriend
Messages: 2
Registered: September 2011
Junior Member
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 Go to previous message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
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.
Previous Topic:UI tests on MAC (JUnit, Fest)
Next Topic:Find/Replace Problem
Goto Forum:
  


Current Time: Fri May 10 04:32:03 GMT 2024

Powered by FUDForum. Page generated in 0.03318 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top