Deployed Java package: Does "getenv" get value inheritted from immediate parent process?
Mostrar comentarios más antiguos
I used Compiler SDK to package an m-file function "ABC" as a Java object and method. When the client Java app instantiates the object to use the method, the MATLAB Runtime is used. My function uses the MATLAB code 'getenv("ABC_ifDebug")' to decide whether to print diagnostics. The deployed "jar" file is used on both Windows and Linux.
The 'getenv' documentation says "returns the value of the operating system environment variable `varname`". This implies that it actually asks the OS for the value of `varname`, i.e., it doesn't use the value inheritted from the parent process. This differs from my understanding of environment variables, which is *inheritted* from the immediate parent process.
The documentation further says "On UNIX® platforms, the shell you use to start MATLAB® determines the operating system environment". This again differs from inheritting the value from the immediate parent.
Is the documentation accurate? If so, it means that MATLAB's treatment of environment variables differs from my decades long understanding (or misunderstanding) of how environment variables work.
I'm tagging this as a MATLAB question because I suspect that the behaviour of "getenv" is the same when using MATLAB versus the runtime. The difference is the context, i.e., for the runtime, the immediate parent might not be the shell or the OS. Or maybe it is but it's just not obvious to me.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Java Package Integration en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!