Annotation
Annotations are used to control the behavior of jCloak. You need to include the annotations in your project.
JCloakEntrypoint
The JCloakEntrypoint is the most important annotation. Without it’s existance, jCloak won’t work. It should be used on the class that is being loaded first. This is typically the Main class.
@JCloakEntrypointpublic class Main {
public static void main(String[] args) { new TestClass(); }}
JCloakLoaded
The JCloakLoaded annotation marks the class for removal and thus hides it from the jar.
@JCloakLoadedpublic class TestClass {
public TestClass() { System.out.println("Hello World"); }}
Native Implementation
You can also create a native dummy class which has native
methods to fake a native implementation.
This is especially usefull when you want to expose api endpoints while hiding their implementation.
This can be done by setting the value
of the annotation to NATIVE_DUMMY
@JCloakLoaded(NATIVE_DUMMY)public class TestClass {
public TestClass() { System.out.println("Hello World"); }}
The result will look like this:
public class TestClass {
public native TestClass();
}