1. Home
  2. Docs
  3. Code Review (previously A...
  4. Libraries (preview)
  5. What is a Java dependency?

What is a Java dependency?

It is possible to extend the Mendix platform with custom Java code. This is particularly helpful if the desired functionality cannot be achieved with Mendix functionality (it is best practice to exhaust platform capabilities before switching to custom code).

When creating custom Java actions in Mendix, you might want to leverage public libraries that contain specific methods and classes. These libraries are added to the Mendix project in the user library folder.

The custom Java actions you create are stored as a java file on the module level.

Each Java action defined in Studio Pro corresponds to a file {name of Java action}.java in the subdirectory javasource/{module name}/actions of the app directory.

In software development, it is common practice to reuse software libraries to speed up development. This same practice inspired the reusable components of the Mendix platform. In Java, this is no different. To speed up development (and stop everybody from reinventing the wheel), you leverage Java libraries with predefined classes and methods. These libraries are commonly stored in what we call a jar file, which stands for Java ARchive.

Within Mendix, all jar files are stored in the userlib in the Mendix project folder. The userlib got its name from “where users (read users of Mendix Studio Pro) add their Java libraries.”

The dependency refers to the relation between the Java action and the jar. The Java action uses specific classes or methods from the jar and is therefore dependent on the jar. If it isn’t there, it doesn’t work.