Setting Environment Variable from Eclipse vs. System
-
15-04-2021 - |
Question
I am using the Gurobi Optimizer, for which I need to set two environment variables: LD_LIBRARY_PATH
and GRB_LICENSE_FILE
.
If I set the variables using Eclipse (Run As --> Run Configuration --> Environment), everything works correctly. If I set the variables through the system (using export
in Linux), I get the error
no GurobiJni46 in java.library.path
Any ideas why this happens and how to fix this?
In the end, I want to run a web application in Tomcat, which would require those variables set correctly.
Solution
In the case where you have set the environment variable using export are you then running your application from inside Eclipse or are you running your application from the command line?
The launcher for Eclipse usually explicitly sets the path using the command line switch -Djava.library.path
which would overwrite what you have set in the environment.
If you set the LD_LIBRARY_PATH
before running Tomcat it would work, provided that Tomcat doesn't override it in one of its start-up scripts!