Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

jvm

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

like image 937
devoured elysium Avatar asked Feb 21 '13 12:02

devoured elysium


1 Answers

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

like image 126
radai Avatar answered Nov 02 '22 04:11

radai