Installation
Prerequisites
Before installing the DolphinDB Java API, make sure you have a Java environment (1.8 or higher) set up. It is recommended to download at Java SE 8 Archive Downloads.
Installing Java API
Maven Project
The DolphinDB Java API is primarily installed and managed through Maven. For example, to use version 3.00.0.2 of the Java API, add the following Maven coordinates to your Maven project's POM file, and then execute a reload.
<!-- https://mvnrepository.com/artifact/com.dolphindb/dolphindb-javaapi -->
<dependency>
<groupId>com.dolphindb</groupId>
<artifactId>dolphindb-javaapi</artifactId>
<version>3.00.0.2</version>
</dependency>
You can specify <version> as needed. It is recommended to use the latest version of Java API.
Non-Maven Project
For a non-maven project, you can download a DolphinDB Java API jar file from the Maven repository and manually import the package. For example, click the "jar" in the Files field to download the Java API.
After downloading, follow these installation steps:
- Create a folder in your project (usually named "lib" or "libs") to store external jar files. You can use an existing directory if it is already created.
- Copy or move the downloaded jar file to the folder.
- In an integrated development environment such as IntelliJ IDEA or Eclipse, right-click your project, then select "Build Path" or "Add to Build Path", and "Configure Build Path".
- In the opened dialog, switch to the "Libraries" or "Dependencies" tab, and click "Add JARs" or "Add External JARs".
- In the file dialog, browse to the folder where the jar file is stored, select the jar file to import, and then click "Open" or "OK".
- Ensure that the selected jar file appears in the build path of the project, then click "Apply" or "OK" to save the changes.
Now you can use the classes and methods of Java API in your project.
Verifying Installation
You can verify the installation by executing the following test script:
@Test
public void testInstallJavaApi() {
BasicString basicString = new BasicString("hello world!");
System.out.println(basicString.getString());
}
Expected output:
hello world!
Starting from version 3.00.0.0, you can call the method
Utils.getJavaApiVersion()
to get the current API version
number.