'How to add java.library.path at RUNTIME?

How to add java.library.path at run time i have tried below but it seems like not working, I also tried option 2 from post but this too not working ;(

// define the var
var path = System.getProperty("java.library.path");
var os = NativeSystem.getFamily().toString().toLowerCase();
var arch = NativeSystem.getArchitecture().toString().toLowerCase();
var libPath = System.getProperty("java.home");

// create path
libPath = libPath.trim() + File.separator + os + File.separator + arch;

// set path
System.setProperty("java.library.path", path + libPath);

There is any way to do it ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source