The Deep Security Java SDK consists of the Java client library and source (JAR files), and several dependency JAR files. The client library enables you to use Java to interact with the API. If you would rather use the API directly via tools such as Postman and curl, you do not need the SDK.
Get set up to use the Java SDK
The Deep Security API supports Java 1.8 and later versions, such as Oracle Java SE 8 and above.
Download and install the JDK and Deep Security Java SDK
Make sure that you download the SDK that is compatible with your Deep Security Manager.
- Install version 1.8 (or later) of the Java Development Kit.
- Download the SDK ZIP file and unzip it.
Trend Micro Deep Security SDKs are distributed under the Apache 2.0 license.
Install a Java IDE
You can use any Java IDE to develop for the Deep Security API. If you need to install one, we recommend using Eclipse. It is free, well-supported, and has a comprehensive feature set. Windows and Linux Download and follow the installation instructions for Eclipse.
Add the SDK to a Java project in Eclipse
Follow the procedure below to create an Eclipse project that can run the code examples in the Automation Center guides.
- Open Eclipse.
- Click File > New Java Project, and click Next. Type a name for the project, such as 'Run Deep Security Code Examples', and click Finish.
- On the New module-info.java window, click Don't Create.
- Right-click the project folder and click Properties.
- Click Java Build Path, click the Libraries tab, click Classpath on the build path tree, and then click the External JARs button.
- Go to the folder containing the extracted SDK, select the
deepsecurity-12.x.xxx.jarfile and click Open.
- Similarly, add all of the files in the lib sub folder from the SDK.
- Click Apply and Close.
- Under the project in the Package Explorer, right-click the 'src' folder and click New > Package.
- Type a package name (for example,
com.trendmicro.deepsecurity.docs) and click Finish.
Add the SDK to your classpath in other IDEs
- Add the
deepsecurity-12.x.xxx.jarfile to the classpath or build path of your Java project.
- Add the JAR files in the lib folder to the classpath or build path of your Java project.
Import self-signed certificates
Java prevents clients from making secure connections to untrusted servers. If the Deep Security Manager in your development environment uses the default self-signed certificate for establishing secure HTTP connections, you need to import the certificate to a local truststore. If you do not import the certificate, you cannot connect to the server.
The path of the default truststore of the JDK's JRE is
JAVA_HOME/jre/lib/security/cacerts, and the default password is
changeit. You can use a different truststore if you like.
- Open the Deep Security Manager console in your web browser.
- Use the browser to download the site's certificate (see your browser documentation)
- Chrome: Developer Tools > Security Tab > View Certificate > Details tab > Copy To File.
- FireFox: Click the lock icon next to the URL > Secure Connection > More Information > View Certificate > Details > Export
- Safari: Click the lock icon next to the URL > Drag the certificate icon to your desktop.
- Use keytool to import the certificate into your truststore (replace the alias and path placeholders with actual values):
keytool -import -v -trustcacerts -alias <alias> -file <path to certificate file> -keystore <path to truststore>
- If you are not using the default truststore of the JRE, run your programs using the following JVM option (replace the path with the actual value):
-Djavax.net.ssl.trustStore=<path to truststore>
- To get familiar with how to use the SDK with the Deep Security API, see the Send Your First Request Using the API guide.
If you are already familiar with using an API or have specific tasks that you want to use the SDK for, see Run the Code Examples to get started with the task-based examples in other Automation Center guides.
You can add the code examples from any of the other Automation Center guides to the project you created above.