Using MXNet from Java application


Hello all,

I am currently evaluating a number of DL frameworks/libraries for use in our Java based system. MXNet would be an interesting choice due to the scalability, AWS support, and pretrained models. However, there is no Java API at the moment.
Has anyone tried to make MXnet usable for a Java application, maybe using Jython as a bridge or similar approach? I’d be grateful for any hints.




I’m curious to hear your use case. Are you looking for a Java API to run training or inference or both?
A majority of users use python API for training. What are your reasons for not going that route? I’m not saying everyone should use Python. Just curious to know the constraints you are operating under.

Regarding Java API, there has been a discussion in dev@ email list on this topic recently:<>

The popular proposal has been to build a Java interface on top of existing scala bindings and improve it based on user feedback. The work on that hasn’t started yet.


Thanks a lot for the reply and your interest. First a brief update to this question: I have been able to get Scala working in the context of our Java-based system, so from that point of view I would be able to use MXNet by way of the Scala API now.

I have read through the thread you pointed to and I agree with Jörn Kottman from OpenNLP that a Java API would be a very useful addition.
Specifically and to answer your question, the need for such a Java API in our case is driven by two factors:

  1. The system that I would like to integrate MXNet with is a Java-based one and therefore using Python is not suitable (I have tried it with Jython, but didn’t work due to problems with module loading). Using Scala would be an option, but introduces another dependency.

  2. Currently, I need to build MXNet natively on the target system even when using Scala API. For deployment purposes, this would be too cumbersome and risky, as the deployment could easily fail the heterogenous production systems that we are working with. Besides, the build from source is not working for me even on my development machine. (cf. Problems with building MXNet Shared Library from source on Mac OS (for Scala))

So, for the moment it seems like it makes more sense to use a different solution, such as Deeplearning4J. I would prefer MXNet, due to the prebuilt models and support from Amazon AWS, but if the library is not usable in a Java environment right now, I can’t really recommend it for our organisation.