GeeCON Prague 2014*
The moose likes Java in General and the fly likes Using the sun.jvmstat.* api Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Using the sun.jvmstat.* api" Watch "Using the sun.jvmstat.* api" New topic
Author

Using the sun.jvmstat.* api

Robin Sharma
Ranch Hand

Joined: Aug 24, 2005
Posts: 76
Hi!

Is there a way to make Sun's PRIVATE java apis visible? For eg. to use the classes in the sun.jvmstat.* package.

Thanks.


DW
There is always a bug :-)
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14195
    
  20

What exactly do you mean by "making them visible"? There is no documentation for the Sun packages and for a good reason; see this: Why Developers Should Not Write Programs That Call 'sun' Packages.

If you are talking about private classes inside a Sun package, then no, there is no way to make those classes visible.

Guessing by the name of the package you are referring to (sun.jvmstat.*) I guess you are interested in JVM statistics? Do you want to profile your application? Have a look at this: Monitoring and Management for the Java Platform.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Robin Sharma
Ranch Hand

Joined: Aug 24, 2005
Posts: 76
Originally posted by Jesper Young:
What exactly do you mean by "making them visible"? There is no documentation for the Sun packages and for a good reason; see this: Why Developers Should Not Write Programs That Call 'sun' Packages.

If you are talking about private classes inside a Sun package, then no, there is no way to make those classes visible.

Guessing by the name of the package you are referring to (sun.jvmstat.*) I guess you are interested in JVM statistics? Do you want to profile your application? Have a look at this: Monitoring and Management for the Java Platform.


Hey Jasper!

I am aware of the stuff you are talking about. I just wanted to explore these apis. The problem is that when i use, say, the above package, the Compiler complains that it cant find the package ... I included "tools.jar" while compiling my sample app but didnt work ...

Thanks.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14195
    
  20

How did you find out about the package "sun.jvmstat"? Maybe it doesn't exist (anymore) in the version of Java that you're using. (Sun is free to change or remove the undocumented Sun packages in newer versions of Java.)
Robin Sharma
Ranch Hand

Joined: Aug 24, 2005
Posts: 76
Originally posted by Jesper Young:
How did you find out about the package "sun.jvmstat"? Maybe it doesn't exist (anymore) in the version of Java that you're using. (Sun is free to change or remove the undocumented Sun packages in newer versions of Java.)


Hey Jasper!

See this link -
http://elliotth.blogspot.com/2005/01/java-equivalent-of-heap1.html
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14195
    
  20

So what version of Java are you using on what platform? The page you gave the link to refers to Java 1.5.

I have Sun Java 1.4.2_12, 1.5.0_09 and 1.6.0 on my computer here (Windows XP) and in tools.jar of version 1.5.0_09 and 1.6.0 there is a package sun.jvmstat which has two subpackages (sun.jvmstat.monitor and sun.jvmstat.perfdata). It's missing in 1.4.2_12.

Note that you can use jar tvf tools.jar to get a list of files that are present in tools.jar. Also, you can view the contents of JAR files with 7-Zip or WinZip.
 
GeeCON Prague 2014
 
subject: Using the sun.jvmstat.* api