Java AOT + loading java classes dynamically

Java AOT + loading java classes dynamically

I'm building a plugin system for my application. I've read that anyone can decomple .class files and therefore I'm forced ot use a Ahead-Of-Time compiler (right?). The problem is that I need to load some plugin classes dynamically. Right now I'm loading all .class files in a folder and invoking a static method (I never create a object) as a plugin system.

Can I load those classes when all my source is AOT compled? Should I approach the problem another way? Is Java the right language for me?

How to wrap all this up into a PHP class?


Protecting PHP classes from undesired instantiation?
Ahead of time compilation is not for blocking people from de-compiling.

Utility classes.. Good or Bad?
I think you should use an obfuscator for that purpose.

C# irc bot connection class
C# Thread and Class problems
Dynamically loading classes for plugin system should work with both the obfuscators and AOT..
Self Instantiation in Java

Initialize a Ruby class from an arbitrary hash, but only keys with matching accessors

Dynamic Inheritance in Ruby


Tahit Akhtar is right.

You need an obfuscator.

You'll have to configure it not to obfuscate the name of the classes and methods that your program uses dynamically to load and call the plugins.

That is, the public SPI of the plugins cannot be obfuscated, but their implementations can.



Unless your classes contain some really top secret functionality I would say drop the obfuscation.... I'm building myself a plug-in framework and I had the same thought to block access to the plug-ins code(since everything sensitive will be there) but I gave up, nowadays everything you can think of is already posted on the web, there are no more secrets in software development ;).

98 out of 100 based on 58 user ratings 758 reviews