Java 中的 java.ext.dirs 系统属性

发布于 2024-11-01 10:20:33 字数 427 浏览 5 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

若水般的淡然安静女子 2024-11-08 10:20:33

我不明白,为什么 Java 会为 java.ext.dirs 属性返回这个非法目录值?

它返回 JVM 将查找的位置。如果列表中存在不存在的目录,我希望它会被默默地忽略。你是否观察到一些不同的东西?

如何从 java.ext.dirs 属性中消除该值?

我对此页面的阅读是,您应该能够设置属性。 (同一页面解释了如何使用路径以及如何确定默认路径。)

您可能需要通过命令行进行设置;例如使用-Djava.ext.dirs=...。我预计 JVM 引导后对属性所做的更改不会产生任何效果。

I'm not understanding, why then Java returns this illegal directory value for java.ext.dirs property?

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?

And how can i eliminate this value from java.ext.dirs property?

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.

深海夜未眠 2024-11-08 10:20:33

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文