Use the PreEmptive Protection™ DashO™ New Project Wizard to protect a Multi-Release JAR file. This article walks you through creating a DashO project for the JAR file, reviewing its inputs and protection settings, configuring JAR signing, and building the protected JAR file.
Prerequisites
- DashO installed.
- The Multi-Release JAR file you want to protect.
- A JDK installation for the Java version your Multi-Release JAR file requires.
- Any supporting JAR files your library needs.
- A keystore file, and its type, password, signing key alias, and key password.
Protect Your Multi-Release JAR
Step 1: Start the New Project Wizard
- Open DashO.
- Go to File > New Project. The New Project Wizard opens.
- On the Select Application Type page, select Library.
-
Click Next.
Step 2: Select the Library and JDK
- On the Select Library page, in Enter the location of your library, click Browse... and select your Multi-Release JAR file.
- In Enter your JDK's location, click Browse... and select the JDK installation directory for your Multi-Release JAR file's Java version.
-
Click Next.
Step 3: Add JAR Files
- On the Add Jars page, verify that your JAR file appears in the Input list.
- (Optional) Under Support jars, click Add... to add any supporting JAR files your library needs.
- Check the Missing classes list. If it lists any classes, add the JAR files that contain them as supports. [Confirm this guidance.]
-
Click Next.
Step 4: Review Entry Points
- On the Select Entry Points page, review the entry points DashO detects. See Examples and Use Cases for a sample list.
- Make sure the classes and methods your library needs are selected. Keep the defaults or adjust them as needed.
-
Click Next.
Step 5: Review Annotation Entry Points
- On the Select Annotation Entry Points page, review the annotation-based entry point options.
- (Optional) Select Generate Entry Point rules based on Hibernate annotations only if your application requires it.
- (Optional) Select the annotations you want to configure as entry points.
-
Click Next.
Step 6: Create the Project File
- On the Select Project File page, in Enter the DashO project file to be created, enter the location and name of your
.doxproject file, or click Browse.... -
Click Finish. DashO opens the new project.
Step 7: Review the Inputs
- In the navigation tree, select Input. The Input - Jars and Classes page opens.
- Verify that your Multi-Release JAR file is listed.
- Review the loaded classes in the class tree.
-
Select Input > Support, and confirm that any required supporting JAR files are listed.
For more information, see Manage Inputs.
Step 8: Review Protection Settings
The wizard enables these protections by default:
- In the navigation tree, review the settings for each protection.
- Adjust the settings for your requirements.
Step 9: Configure JAR Signing
- In the navigation tree, select Output > Signing. The Output - Signing page opens.
- Select Sign Jars/WAR/APK/AAB.
- In Signing Tool, enter or browse to the path of the signing tool, such as
jarsignerin your JDK'sbindirectory. - Under Key Store, click Browse... next to Location and select your keystore file.
- Enter the keystore Type and Password.
- Under Signing Key, enter the Alias and Password.
-
(Optional) Under Options, set Signature File, Internal .SF, Sections Only, or Additional Arguments. See Output and Build Results.
Step 10: Build the Protected JAR
- Save the project.
- Click Build.
- When the build finishes, check the Console and Problems tabs and confirm there are no errors.
- Find the protected JAR file in the configured output directory. See Output and Build Results.
- Verify that the output contains the expected classes and Multi-Release JAR structure.
Examples and Use Cases
For a sample library named mrjar-sample-1.0.0.jar, the wizard detects these entry points:
-
mrjar-sample-1.0.0.jaras a library Main public static main(java.lang.String[])VersionTester public static main(java.lang.String[])
After the build, the Results page shows the original class names and their new names.
Limitations and Troubleshooting
| Issue | Cause and resolution |
|---|---|
The protected JAR file throws ClassNotFoundException or other runtime errors. |
The JDK doesn't match your Multi-Release JAR file's Java version. Select the matching JDK on the Select Library page, or on the Input > Support page, and build again. |
The console shows: Support for running on Java 8 is deprecated and will be removed in a future release.
|
DashO is running on Java 8. |