Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 29th, 2012, 07:32 AM
sanaa1 sanaa1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 6 sanaa1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 16 m 12 sec
Reputation Power: 0
Exclamation Homework - Importing sun package in java

Hello there,
I am working on some multitasking sort of application.
I need to keep log of all java processes being running currently. For that purpose I found that I need to import sun.jvmstat.monitor.*;
but I am getting error on this import i.e.
import sun.jvmstat cannot be resolved

I am extremely new to java so i dont know much about jre paths etc. please provide an easy step by step solution to this problem. I am using eclipse IDE.

ps. I also tried to follow a solution on stackoverflow website
on how-do-i-include-jvmstat
this directed me to download j2eesdk-1_4_03-windows
I downloaded and installed this but couldnt help me in my problem

I would appreciate your help.
Regards

Reply With Quote
  #2  
Old December 29th, 2012, 10:45 AM
NormR's Avatar
NormR NormR is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Aug 2010
Location: SW Missouri
Posts: 2,955 NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 2 h 51 m 13 sec
Reputation Power: 345
Where did you see the classes described that are in the package you are having problems with?

Reply With Quote
  #3  
Old December 29th, 2012, 01:25 PM
sanaa1 sanaa1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 6 sanaa1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 16 m 12 sec
Reputation Power: 0
Quote:
Originally Posted by NormR
Where did you see the classes described that are in the package you are having problems with?


sorry i didnt get your question..
I am having error on import sun.jvmstat

Reply With Quote
  #4  
Old December 29th, 2012, 01:27 PM
NormR's Avatar
NormR NormR is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Aug 2010
Location: SW Missouri
Posts: 2,955 NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 2 h 51 m 13 sec
Reputation Power: 345
Quote:
import sun.jvmstat

Why do you want to do that?

Reply With Quote
  #5  
Old December 29th, 2012, 02:26 PM
sanaa1 sanaa1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 6 sanaa1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 16 m 12 sec
Reputation Power: 0
Quote:
Originally Posted by NormR
Why do you want to do that?


I want to run this code:

import java.util.*;
import sun.jvmstat.monitor.*;
public class ListJavaProcess {

public static void main(String[] args) throws Exception {

/* Checking for local Host, one can do for remote machine as well */

MonitoredHost local = MonitoredHost.getMonitoredHost("localhost");

/* Take all active VM's on Host, LocalHost here */

Set vmlist = new HashSet(local.activeVms());

for (Object id : vmlist) {

/* 1234 - Specifies the Java Virtual Machine identified by lvmid 1234 on an unnamed host.

This string is transformed into the absolute form //1234, which must be resolved against

a HostIdentifier. */

MonitoredVm vm = local.getMonitoredVm(new VmIdentifier("//" + id));

/* take care of class file and jar file both */

String processname = MonitoredVmUtil.mainClass(vm, true);

System.out.println(id + " ------> " + processname);

}

}
}

Reply With Quote
  #6  
Old December 29th, 2012, 02:38 PM
NormR's Avatar
NormR NormR is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Aug 2010
Location: SW Missouri
Posts: 2,955 NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 2 h 51 m 13 sec
Reputation Power: 345
Where did you get the code? Did the author of that code say where the classes are that are needed?

Did you google on the package name to see details on the history of that package?
It's at least 6 years old and out of date.

Reply With Quote
  #7  
Old December 29th, 2012, 03:11 PM
sanaa1 sanaa1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 6 sanaa1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 16 m 12 sec
Reputation Power: 0
Quote:
Originally Posted by NormR
Where did you get the code? Did the author of that code say where the classes are that are needed?

Did you google on the package name to see details on the history of that package?
It's at least 6 years old and out of date.



Actualy I searched on how to keep the log of all java process being running and I also need to display them. So, all the links which I got includes this same package. i.e.
Import sun.jvmstat

now what to use instead?

Reply With Quote
  #8  
Old December 29th, 2012, 03:23 PM
NormR's Avatar
NormR NormR is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Aug 2010
Location: SW Missouri
Posts: 2,955 NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 2 h 51 m 13 sec
Reputation Power: 345
It may not be possible. Did you Ask Google about the package?

Reply With Quote
  #9  
Old December 29th, 2012, 03:29 PM
sanaa1 sanaa1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 6 sanaa1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 16 m 12 sec
Reputation Power: 0
Quote:
Originally Posted by NormR
It may not be possible. Did you Ask Google about the package?


yes i did. would you give me some solution now???

Reply With Quote
  #10  
Old December 29th, 2012, 03:31 PM
NormR's Avatar
NormR NormR is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Aug 2010
Location: SW Missouri
Posts: 2,955 NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 2 h 51 m 13 sec
Reputation Power: 345
I have no solution.

Reply With Quote
  #11  
Old December 29th, 2012, 03:34 PM
sanaa1 sanaa1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 6 sanaa1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 16 m 12 sec
Reputation Power: 0
Quote:
Originally Posted by NormR
I have no solution.


OK

Reply With Quote
  #12  
Old December 30th, 2012, 10:02 PM
tvc3mye's Avatar
tvc3mye tvc3mye is offline
Daniel Schildsky
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Mar 2004
Location: KL, Malaysia.
Posts: 1,534 tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level)tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level)tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level)tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level)tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level)tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level)tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level)tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level)tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level)tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level)tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level)tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level)tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level)tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level)tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level)tvc3mye User rank is General 10th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Weeks 4 Days 2 h 27 m 57 sec
Reputation Power: 1620
Send a message via MSN to tvc3mye Send a message via Yahoo to tvc3mye Send a message via Google Talk to tvc3mye Send a message via Skype to tvc3mye
Facebook
Monitoring JVM processes

I am not sure if it is possible to log all JVM processes, but for displaying and monitoring them, I have found this from google:
JConsole

JConsole displays a graphical UI to present various aspects of a particular or some processes or all JVM processes currently running. Try it out and see if it satisfies what you are trying to achieve.

You need to write your own codes only if it still can't fulfill your needs.
__________________
When the programming world turns decent, the real world will turn upside down.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Homework - Importing sun package in java

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap