Setup development environment¶
Install the Java Development Kit¶
The Deep Java Library (DJL) project requires JDK 11 (or later).
Verify that Java is available in your $PATH environment variable by using the following commands. If you have multiple versions of Java installed, you can use the $JAVA_HOME environment variable to control which version of Java to use.
sudo apt-get install openjdk-11-jdk
sudo yum install java-11-openjdk
brew tap homebrew/cask-versions brew update brew install --cask temurin11
You can also download and install Oracle JDK manually if you have trouble with the previous commands.
(Optional) Use IntelliJ¶
You can use the IDE of your choice. We recommend using IntelliJ.
Import the DJL project into IntelliJ¶
- Open IntelliJ and click
- Navigate to the DJL project root folder and choose
Import project from existing modeland select
- Select the default configuration and choose
(Optional) Import using Gradle/Maven wrappers¶
You use Gradle and Maven wrappers to build the project, so you don't need to install Gradle or Maven. However, you should have basic knowledge about the Gradle or Maven build system.
DLJ defaults to the MXNet Engine which is not supported on M1 Macs. To get your code to run on a mac use either:
- The environment variable
DJL_DEFAULT_ENGINE=PyTorchwhich you can export on the command line or set in the Edit Run Configuration in Intellij.
- The runtime commandline parameter
-Dai.djl.default_engine=PyTorchwhich you can add to the end of the command line when running or add in the Edit Run Configuration in Intellij.