LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-15-2010, 04:18 AM   #1
rosy Jovita
LQ Newbie
 
Registered: Mar 2010
Posts: 11

Rep: Reputation: 0
3rd party library


Hi all,

i was trying to get the status of memory usage and disk usage using sigar in windows and ubuntu. done this in windows by just copying the sigar library into jdk library. But i was unable to do so in ubuntu. I've copied the library to java-6-sun library but still can't run the program.
what should i do?
please help
 
Old 03-15-2010, 04:19 AM   #2
Sayan Acharjee
Member
 
Registered: Feb 2010
Location: Bangalore, India
Distribution: Linux Mint 13
Posts: 590

Rep: Reputation: 64
You can check memory uses and disk uses using the following command:
Quote:
#vmstat
Quote:
#free
and

Quote:
#df -H
You can also check this file: /proc/meminfo

Last edited by Sayan Acharjee; 03-15-2010 at 04:22 AM.
 
Old 03-15-2010, 04:24 AM   #3
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,627

Rep: Reputation: Disabled
For graphical representation of the same put into one, you can use gnome-system-monitor.
 
Old 03-15-2010, 04:29 AM   #4
rosy Jovita
LQ Newbie
 
Registered: Mar 2010
Posts: 11

Original Poster
Rep: Reputation: 0
sayan and linuxlover,

i am doing this for my final year project. I can't simply use that.
I have to write my own code for that.
please, i need help with the third party libray.
where should i copy the library to?
 
Old 03-15-2010, 04:33 AM   #5
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,627

Rep: Reputation: Disabled
Even if you copy it to jdk, you need to have jdk in your path to execute it directly. Else you will need complete path to the executable.
And can you tell what you did in Ubuntu?
 
Old 03-15-2010, 04:38 AM   #6
Sayan Acharjee
Member
 
Registered: Feb 2010
Location: Bangalore, India
Distribution: Linux Mint 13
Posts: 590

Rep: Reputation: 64
You can try copying that library file in /lib directory.........
 
Old 03-15-2010, 04:43 AM   #7
rosy Jovita
LQ Newbie
 
Registered: Mar 2010
Posts: 11

Original Poster
Rep: Reputation: 0
i copied the sigar.jar and the other sigar's important libraries into the jdk library in ubuntu.
i was trying to get the memory usage status. hwhat should i do with the libraries?
i have even tried to put the library in the same directory with the code, and compile it.
compile successfully, but once i run the code using this command:
java -cp sigar.jar MemoryMonitor
it gave me this error:

rose@rose-desktop:~$ java -cp sigar.jar MemoryMonitor
Exception in thread "main" java.lang.NoClassDefFoundError: MemoryMonitor
Caused by: java.lang.ClassNotFoundException: MemoryMonitor
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: MemoryMonitor. Program will exit.

so, i guess, it will be better for me to simply put the library in the jdk library.
i don't have to type that command each time i wanted to compile and run the code.
 
Old 03-15-2010, 04:47 AM   #8
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,519

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
http://www.hyperic.com/products/sigar

> > http://sourceforge.net/projects/sigar/files/
> http://sourceforge.net/projects/siga...3.zip/download
> > hyperic-sigar-1.6.3.zip

unzip hyperic-sigar-1.6.3.zip :
The Linux library is libsigar-x86-linux.so (( or libsigar-ia64-linux.so ))

The windows version will of course not work in Linux !

And please read the documentation :
hyperic-sigar-1.6.3/docs/javadoc/index.html

The source code ( in case the binary lib isn't working )
http://sourceforge.net/projects/siga...ar.gz/download
> hyperic-sigar-1.6.3-src.tar.gz
.....
 
Old 03-15-2010, 05:04 AM   #9
rosy Jovita
LQ Newbie
 
Registered: Mar 2010
Posts: 11

Original Poster
Rep: Reputation: 0
OMG,

i have done that, i've mentioned earlier. Please, i have read the documentation, it's not helpful at all.
they didn't stated how to and where to put the library in ubuntu.
 
Old 03-15-2010, 05:18 AM   #10
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
OMG! Link us to the actual guide/docs you used then, instead of telling people the free advice they're giving you in their free time is not helpful.

Consider doing a FYP you can do, or if not, doing a degree you'll work harder towards next time. Maybe a degree with a strong element in Reading; Look at what Sayan said:

Quote:
You can also check this file: /proc/meminfo
.

Did you read the file? Do you understand what /proc/ is? On Linux, all you really need is to be reading from /proc/- you'll save yourself a lot of work.
 
Old 03-15-2010, 06:21 AM   #11
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,519

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
The shared library = libsigar-x86-linux.so :
/usr/lib/ will be OK for it to be found, I guess.

"files.jar" goes to /usr/share/java/ , but be careful,
similar jar files may be there already.

.....
 
Old 03-16-2010, 03:00 AM   #12
rosy Jovita
LQ Newbie
 
Registered: Mar 2010
Posts: 11

Original Poster
Rep: Reputation: 0
hi knudfl,

Thanks for being patient and guiding me.
I've copied that into both directory and once i compile the program,
i got this error:

MemoryMonitor.java:3: package org.hyperic.sigar does not exist
import org.hyperic.sigar.Mem;
^
MemoryMonitor.java:4: package org.hyperic.sigar does not exist
import org.hyperic.sigar.Swap;
^
MemoryMonitor.java:5: package org.hyperic.sigar does not exist
import org.hyperic.sigar.Sigar;
^
MemoryMonitor.java:6: package org.hyperic.sigar does not exist
import org.hyperic.sigar.SigarException;
^
MemoryMonitor.java:11: cannot find symbol
symbol : class Sigar
location: class MemoryMonitor
private static Sigar sigar = new Sigar();
^
MemoryMonitor.java:11: cannot find symbol
symbol : class Sigar
location: class MemoryMonitor
private static Sigar sigar = new Sigar();
^
MemoryMonitor.java:22: cannot find symbol
symbol : class Mem
location: class MemoryMonitor
Mem mem = null; // assign memory and swap memory to null
^
MemoryMonitor.java:23: cannot find symbol
symbol : class Swap
location: class MemoryMonitor
Swap swap = null;
^
MemoryMonitor.java:30: cannot find symbol
symbol : class SigarException
location: class MemoryMonitor
catch (SigarException s){
^
9 errors

still, the library is not found
and sayan, thanks for the suggestion

Last edited by rosy Jovita; 03-16-2010 at 03:45 AM.
 
Old 03-16-2010, 03:44 AM   #13
rosy Jovita
LQ Newbie
 
Registered: Mar 2010
Posts: 11

Original Poster
Rep: Reputation: 0
james,

it's good to know that you are expert but you have no right to scold other.
please be nice, this is forum. Some might not be happy with what you said.
Anyway, thanks for that.
 
Old 03-16-2010, 03:51 AM   #14
Sayan Acharjee
Member
 
Registered: Feb 2010
Location: Bangalore, India
Distribution: Linux Mint 13
Posts: 590

Rep: Reputation: 64
@rosy Jovita, Most welcome.
 
Old 03-16-2010, 04:07 AM   #15
rosy Jovita
LQ Newbie
 
Registered: Mar 2010
Posts: 11

Original Poster
Rep: Reputation: 0
Hi Guys,

I did it!
thanks a lot, using this command: javac ./sigar.jar:. MemoryMonitor.java
I guess, it's better to do it this way rather than copy the library into java library.
Thanks all.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
3rd party repos / compiling klapaucius Slackware 6 07-20-2008 05:13 PM
RHEL 5 and 3rd Party Repositories. zcrxsir88 Linux - Security 2 02-18-2008 07:58 PM
Assessing 3rd-party packages dhave Slackware 2 07-21-2005 06:22 AM
how to install 3rd party .deb SlipAway172 Ubuntu 1 05-12-2005 09:53 PM
Safety of 3rd party cd's robby737 Linux - Security 5 06-16-2004 11:04 AM


All times are GMT -5. The time now is 07:08 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration