?
Solved

Check if a Virtual Machine (VM) is running

Posted on 2011-10-19
14
Medium Priority
?
373 Views
Last Modified: 2012-05-12
Please let me know if there's a way I can check a given Virtual Machine (VM) is running.
The VM is not necessarily the Java VM.

Thanks!
0
Comment
Question by:dshrenik
  • 8
  • 4
  • 2
14 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 1000 total points
ID: 36995880
Use tasklist or some such utility from within Java (on Windows)
0
 

Author Comment

by:dshrenik
ID: 36995890
How can I do it in an OS-independent way? Thanks!
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36995895
Waht means VM is not necessraily Java VM ?

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 47

Expert Comment

by:for_yan
ID: 36995900
What other VM do you have in mind?
0
 

Author Comment

by:dshrenik
ID: 36995915
Its being developed in my company. Not released yet.
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 1000 total points
ID: 36995928

You probably cannot do it in OS independent way, but you cvan detemrin
System.getProperty("os.name") and based on that
cover most important OS, like here:

http://stackoverflow.com/questions/54686/how-to-get-a-list-of-current-open-windows-process-with-java


http://stackoverflow.com/questions/6665782/list-of-running-programs-in-linux-using-java
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36995945
Your company may name it as they want and from point of view of OS VM is nothing more but one more application so there is no way
you can know thatbtis task is VM and thsi is not and you even have to come up with definition what is VM
Processing of any text can also be considered VM - so this is not very clearly defined
0
 

Author Comment

by:dshrenik
ID: 36995981
Let me simplify the question:
Can I get to know the names of the Java packages that are active.
Like in Java VisualVM, you can check the packages that are active..
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36995992
Sorry what is Java VisualVM and waht you mean by packages?
0
 

Author Comment

by:dshrenik
ID: 36996004
C:\Program Files (x86)\Java\jdk1.6.0_20\bin\jvisualvm.exe
It is used for profiling.

What I meant was when I have a Java application running (could be third party), how do I know the names of the packages of the classes that are running?
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36996031
That is absolutely different question that your company writing soem new virtual machine

But I don't think you can do it from outside of your java code
You can look at the classpath of your application but what packages are running at particular moment?
It is hardly possible to track from outside, I think
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36996035
You may use
jstack -l pid
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36996043
where pid is the pid number in task manger of your process -jastack in your Java/bin folder will have some printout of
threads  currently running and there are some class names there
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 36996412
:)
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month14 days, 5 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question