Java 中的 java.ext.dirs 系统属性
我在 Windows XP 操作系统上使用 JDK 1.6。运行一个简单的 Java 程序来打印 java.ext.dirs
系统属性的值:
System.getProperty("java.ext.dirs")
prints:
C:\Program Files\Java\jre6\lib\ext;C:\WINDOWS\Sun\Java\ lib\ext
在打印的两个目录中,第二个目录在我的系统中不存在,即 C:\WINDOWS\Sun\Java\lib\ext
目录在我的系统中不可用。
我不明白,为什么 Java 返回这个非法的目录值 java.ext.dirs
财产? 我怎样才能从 java.ext.dirs 属性中消除这个值?
I'm using JDK 1.6 on Windows XP OS. Running a simple Java program to print the value of java.ext.dirs
System property:
System.getProperty("java.ext.dirs")
prints:
C:\Program Files\Java\jre6\lib\ext;C:\WINDOWS\Sun\Java\lib\ext
Out of the two directory that got printed, the second one does not exists on my system i.e. C:\WINDOWS\Sun\Java\lib\ext
directory is not available in my system.
I'm not understanding, why then Java returns this illegal directory value for java.ext.dirs
property?
And how can i eliminate this value from java.ext.dirs
property?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它返回 JVM 将查找的位置。如果列表中存在不存在的目录,我希望它会被默默地忽略。你是否观察到一些不同的东西?
我对此页面的阅读是,您应该能够设置属性。 (同一页面解释了如何使用路径以及如何确定默认路径。)
您可能需要通过命令行进行设置;例如使用
-Djava.ext.dirs=...
。我预计 JVM 引导后对属性所做的更改不会产生任何效果。It is returning the places that the JVM will look. If there is a non-existent directory in the list, I'd expect it to be silently ignored. Are you observing something different?
My reading of this page is that you should be able to set the property. (The same page explains how the path is used, and how the default is determined.)
You probably need to set it via the command line; e.g using
-Djava.ext.dirs=...
. I'd expect changes to the property made after the JVM had bootstrapped to have no effect.Java 将在这些目录中查找扩展。如果其中一个目录不存在,则不会在那里找到扩展名 - 没什么大不了的,为什么这很重要?
在任何情况下,如果您愿意,都可以在 Java 命令行上提供
-Djava.ext.dirs=PATH
。Those are directories in which Java will look for extensions. If one of the directories isn't there, no extensions will be found there -- no big deal, why does it matter?
In any case, you can provide
-Djava.ext.dirs=PATH
on the Java command line, if you'd like.