如何分发 AWTUtilities
我最近阅读了关于 Pushing Pixels 的博客文章,其中描述了如何使用纯 Java 实现本机透明和半透明。所需的类位于 com.sun.awt 上,即 com.sun.awt.AWTUtilities。
我想知道如何将所需的类(不仅仅是这个)包含到我的发行版中,因为只有当您安装了 jdk 并通过那里启动 jvm 时,这些类才可用。因此我的程序的用户将没有运行我的程序所需的类。
有什么想法吗?
I recently read the blog posts on Pushing Pixels that describe how to achieve native transparency and translucency with pure Java. The needed classes reside on com.sun.awt namely com.sun.awt.AWTUtilities.
I was wondering how i could include the needed classes (not just this one) into my distro since the classes are available only when you have a jdk installed and you start the jvm through there. So the users of my program will not have the needed classes to run my program.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如该包所暗示的那样,AWTUtilities 是一个实现包,并且可能会发生变化。我认为从技术和法律角度来分配课程并不是一个好主意。
从技术上讲,com.sun.awt.AWTUtlities 必然对其他类和内部实现细节具有可能未知的依赖关系,特定于 Java 6 u10 及更高版本 (它出现的版本)。这种未知的依赖关系一定会成立,因为绘画和图形也需要对某些本机实现进行更改。
其次,这在 Java 7 中肯定会发生变化,因为 Sun 唯一没有发布支持透明性的 java.awt.AWTUtilities 的版本,是因为除了主要版本之外,它们不会对公共 API 进行更改。
IANAL,但我认为在没有经过律师的情况下从事重新分发软件的行为是不明智的。此外,客户不喜欢在其系统中部署不受支持的任何软件。
更新
从 6u10 开始,所有 Sun JRE(不仅仅是 JDK)都附带 com.sun.awt.AWTUtilities,因此最简单的做法是让您的用户在其系统上安装 Java 6u10 或更高版本,并让您的应用程序能够优雅地处理任何产生的异常。
AWTUtilities, as the package implies is an implementation package and is subject to change. I don't think it is a good idea to distribute the class from both technical and legal viewpoints.
Technically, com.sun.awt.AWTUtlities is bound to have possibly unknown dependencies on other classes and internal implementation details, specific to Java 6 u10 and above (the release in which it appeared). This unknown dependency angle is bound to hold water, since painting and graphics will require changes in some of the native implementations as well.
Secondly, this is bound to change in Java 7, since the only release Sun hasn't made a release of java.awt.AWTUtilities with support for transparency, is because they do not make changes to public APIs except in major releases.
IANAL, but I do not think it is wise to engage in the act of redistributing software without having run past a lawyer. Besides, customers do not like the idea of having an unsupported deployment of any software in their systems.
Update
All Sun JREs (not just JDKs) from 6u10 onwards come with com.sun.awt.AWTUtilities, so the simplest course of action would be to get your users to have Java 6u10 or later on their systems, and for your application to handle any resulting exception gracefully.