Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting LD_LIBRARY_PATH in java in unix  RSS feed

 
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

System.getenv("LD_LIBRARY_PATH");
This prints the value of $LD_LIBRARY_PATH in unix.

How to set "LD_LIBRARY_PATH" through java?
System.setProperty("LD_LIBRARY_PATH",path) is not working.

There is no System.setenv()

Thanks,
Guru
 
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where do you need this for?
You cannot change environment variables for existing processes. The only way to change environment variables for any new process is to use the proper mechanisms; you would need to add it to your Bash profile configuration file, or its equivalent for your current shell.

However, if you launch processes from Java using Runtime.exec or ProcessBuilder, you can add extra environment variables to the new process. Check the documentation on how to.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!