If you want to call functionality from a different codebase from your Mendix application the usual way to do this would be for your other codebase to expose a REST or SOAP interface, and the Mendix application to call that to pass data between the two systems.
I hope this helps.
While I generally agree with Robert, I think it’s important to note that Mendix is extensible via Java, and you can import Java libraries (JAR files) and use them in your Java action code:
https://docs.mendix.com/howto/logic-business-rules/extending-your-application-with-custom-java/