This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using the sun.jvmstat.* api

 
Robin Sharma
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Robin Sharma
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic