Hacker News new | ask | show | jobs
by tfmatt 3125 days ago
Is there a similar Java centric type override? Would it be as simple as dropping a jar in the right location or is there an environment variable that can be over written? Also it would be neat to know the java code to chain the "open" system call like he did.
3 comments

Probably not with an environment variable, but you can always replace the java executable with another executable that adds an option like -Xbootclasspath.
You can override the ClassLoader (and use other reflection tricks after that) to do almost anything, see e.g. http://blog.cyberborean.org/2007/07/04/custom-classloaders-t...
You can write a Java agent to overwrite the classfiles as they're loaded.

At startup, you can use the `-javaagent:<path/to/jar>` option, and you can also bind an agent to other JVMs, programmatically, at runtime with a bit of hackery.