This template helps you writing your own optimization model in Java. It contains several files to easily deploy the model to the Nextmv platform.
Java templates in Nextmv require a main.jar
as an entry point. Running the
following command will generate a main.jar
in the root direcotry of the
project.
mvn package
After that you can run the main.jar
file with the following command:
java -jar main.jar --input input.json
You can also push the main.jar
file to the Nextmv Cloud and run it remotely.
Take a look at the documentation on how to
deploy and
run an app in
the Nextmv Cloud.
Pre-requisites: Docker needs to be installed.
To run the application locally in the same docker image as the one used on the Nextmv Cloud, you can use the following command:
mvn package && cat input.json | docker run -i --rm \
-v $(pwd):/app ghcr.io/nextmv-io/runtime/java:latest \
java -jar /app/main.jar
You can also debug the application by running it in a Dev Container. This
workspace recommends to install the Dev Container extension for VSCode. If you
have the extension installed, you can open the workspace in a container by using
the command Dev Containers: Reopen in Container
.
- Open
main.jar
and start writing the model in Java. - Further documentation, guides, and API references about custom modeling and deployment can also be found on our blog and on our documentation site.
- Need more assistance? Send us an email!