In Ubuntu 16, I had set LD_LIBRARY_PATH via the file /etc/environment and it worked (guaranteed).

After the upgrade to 18.04 it does not.

I read various posts and the documentation regarding environment variables, and it appears that the way to do it is to create a file


and add the lines there and then run


I did that, but

  1. echo $LD_LIBRARY_PATH gives an empty line
  2. when I execute a simple java-Program with System.out.println(System.getProperty("java.library.path")); the result is not what is in the files in the folder /etc/ld.so.conf.d. It seems that this mechanism is not working.

I don't understand this.

  • I don't think you can add environment variables to files in /etc/ld.so.conf.d - just library paths themselves. What is the actual issue that you are trying to solve by setting LD_LIBRARY_PATH? – steeldriver Sep 7 '18 at 11:29
  • I need it for the gurobi optimizer. – Christian Sep 7 '18 at 11:59
  • I don't know what that is - however, rather than setting LD_LIBRARY_PATH globally, it's more usual to create a wrapper script for a particular application in which you set environment variables specific to that application, then call it. Setting LD_LIBRARY_PATH globally is likely to have unintended consequences for other programs. – steeldriver Sep 7 '18 at 12:07
  • I need the optimizer to work. I imagine the risk of consequences for other programs is rather low. – Christian Sep 7 '18 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.