You can use some obfuscation tools, like ProGuard.
A self written ClassLoader, must be placed in a standard .class file, that the JVM can load it. And then you secure loader can be reverse engineered.
Don’t do it by yourself. Writing “secure” code without knowing cryptographic algorithms will lead to error-prone an insecure code
5
solved Custom Class Loader In Java [closed]