To start with Java, you need to first set up a Maven project and add the following dependency to your pom.xml.
This is an enumeration of two libraries:
This process wraps up all the TensorFlow C++ libraries and JNI connector to access it through Java programs.
By default, it works on CPU powers. You can also add the following dependency to support GPU acceleration.
Now, you're ready to use TensorFlow features on Java.
For the whole program of training the model, refer the following link: https://github.com/tensorflow/models/blob/master/samples/languages/java/training/src/main/java/Train.java