以编程方式设置Java.library.path [英] Java.library.path setting programmatically

查看:127
本文介绍了以编程方式设置Java.library.path的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以从java代码本身以编程方式设置java.library.path吗?

Can I set java.library.path programmatically from java code itself?

以下内容不起作用。

    System.setProperty("java.library.path", "/blah");


推荐答案

不,你不能。此属性是只读值。您可以使用以下命令在JVM启动时更改它:

No you can't. This property is a read only value. You can change it at JVM launchin time with:

-Djava.library.path=your_path

如果要从特定位置加载库,可以使用 System.load(libraryPath)而不是完整路径到图书馆。

If you want to load a library from a specific location, you can use System.load(libraryPath) instead with the full path to the library.

这篇关于以编程方式设置Java.library.path的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆