Getting started
Quick start
Protect a first jar with a minimal configuration and a profile.
This page takes a compiled jar from your build and produces a protected copy with a profile and nothing else. It assumes the CLI is installed and your licence is active on this machine.
Write a configuration
Create obfuscator-config.json next to your build:
{
"input": "build/libs/app.jar",
"output": "build/libs/app-protected.jar",
"libraries": ["libs/dependency.jar"],
"options": {
"profile": "Medium"
}
} inputis the jar to protect andoutputthe jar HashGuard writes.librarieslists the jars your code depends on. HashGuard reads them to resolve the class hierarchy and compute stack frames; it never modifies them. Leave the array empty if the jar has no dependencies.profilesets a baseline of protections.Mediumadds string encryption, constant masking and call indirection on top of renaming. See Profiles.
The file must be strict JSON: no comments, no trailing commas.
Run it
hashguard -config obfuscator-config.json The CLI checks the licence, runs the pipeline phase by phase and writes build/libs/app-protected.jar. Run your test suite or start the application from the protected jar to check that it behaves like the original.
When something breaks
Most issues come from code that relies on names: reflection, serialization, configuration files that name classes, service loaders. Keep those names:
- with annotations such as
@KeepNamein your code; - or with exclusion rules in the config, for code you do not own.
Next steps
- Raise the profile, or switch individual passes on and off, with the options.
- Export a mapping to decode stack traces from production.
- Run HashGuard from your build with the Gradle plugin, or in CI.