javax vs java包 [英] javax vs java package
问题描述
javax包背后的理由是什么?什么进入java和什么进入javax?
What's the rationale behind the javax package? What goes into java and what into javax?
我知道很多企业-y包都在javax中,但是Swing也是如此,新的日期和时间api(JSR) -310)和其他J2SE软件包。
I know a lot of enterprise-y packages are in javax, but so is Swing, the new date and time api (JSR-310) and other J2SE packages.
推荐答案
我认为这是历史性的事情 - 如果一个软件包被引入作为现有的JRE,它以 javax
的形式出现。如果它首次作为JRE的 part 引入(比如NIO,我相信),那么它将以 java
的形式出现。不知道为什么新的日期和时间API最终将作为 javax
遵循此逻辑...除非它也将作为库单独提供以使用早期版本(这将是有用的)。 许多年后的注意事项:它实际上最终只是在 java
中。
I think it's a historical thing - if a package is introduced as an addition to an existing JRE, it comes in as javax
. If it's first introduced as part of a JRE (like NIO was, I believe) then it comes in as java
. Not sure why the new date and time API will end up as javax
following this logic though... unless it will also be available separately as a library to work with earlier versions (which would be useful). Note from many years later: it actually ended up being in java
after all.
我认为 java
包有限制 - 我认为类加载器设置为仅允许 java中的类。 *
从 rt.jar
或类似的东西加载。 (肯定有一个支票 ClassLoader.preDefineClass
。)
I believe there are restrictions on the java
package - I think classloaders are set up to only allow classes within java.*
to be loaded from rt.jar
or something similar. (There's certainly a check in ClassLoader.preDefineClass
.)
编辑:虽然官方解释(搜索orbfish建议)在第一页中没有得到一个左右)毫无疑问是核心与扩展,我仍然怀疑在许多情况下,对任何特定包的决定也有其背后的历史原因。例如, java.beans
真的是Java的核心吗?
While an official explanation (the search orbfish suggested didn't yield one in the first page or so) is no doubt about "core" vs "extension", I still suspect that in many cases the decision for any particular package has an historical reason behind it too. Is java.beans
really that "core" to Java, for example?
这篇关于javax vs java包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!