devoured elysium
devoured elysium

Reputation: 105077

Programmatically detect whether the JVM is using Class Sharing or not?

Some JVMs have the Class Sharing option set on. Is there a way to detect whether that option is set on or off programmatically?

Thanks

Upvotes: 6

Views: 114

Answers (1)

radai
radai

Reputation: 24192

no sane way to get this that i know of...

you could get the command line used to invoke your JVM and look fo the flags described here. if all you want to do is enforce that the feature is turned off thats easy - require the off flag to be present.

note that this doc is for 1.5 and it says that sharing also depends on the garbage collector being used, so you'll need to deduce that as well (also possible, given jvm version, command line, OS version and a lot of patience :-) ).

also you'll need to address this on a per-jvm vendor. the ibm jvm, for example, uses different flags

Upvotes: 3

Related Questions