Since I have got no reply, I did some thorough investigation about it and a found a somewhat near solution to what I am looking for.
This can be enabled through the Java instrumentation API which allows you to insert "programming statements"
to a method at runtime and upon the start of the Java virtual machine. What you have to do is to write a class
in a specific form that and pass it to JVM as an argument when it starts.