How do I configure the Java Librarypath to load paths based on a user's loaded software?
Show older comments
I am an HPC system administrator. We have a software package on our cluster which has multiple versions installed. We also regularly wind up updating the software and adding a new package for the latest version (it's called MDSplus, though I doubt that matters).
The software includes a java version. Previously, we had a single symlink which we would then redirect at a particular version. This symlink was then used by two entries in the classpath and one entry in the librarypath. Our plan is to add the classpath entries directly from the matlabrc file (no sense creating a system-wide startup.m file which then had to be checked for and told to run when there are only two lines consisting of javaaddpath(fullfile(getenv('softwarepackagename'), 'path', 'to', 'someJar')) which users should never interact with.), but we are struggling with what to put in the Librarypath.
The librarypath.txt file supports macros such as $matlabroot, but I can't see how to either read a normal bash variable here or potentially insert a custom macro which can then be expanded. Here's the documentation on Native Methods I'm pulling from. I assume this was some intentional design decision, I'd be grateful to understand the logic here (for example, the JVM librarypath only gets set when MATLAB starts so there's no potential issue with the variable getting modified the way there is with a classpath definitions).
Based on this answer, we're pretty sure this is the best way to correctly make the software available, but perhaps there's some better way to add directories to the JVM librarypath during startup. If we can somehow use bash variables to control the versioning, lmod becomes able to drastically reduce our maintenance work. One thing I was considering is #2 from this answer but I've never used this I'm not sure whether that would do what we're wanting.
Any wisdom would be greatly appreciated!
Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!