views:

420

answers:

1

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?

+3  A: 

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.

Vineet Reynolds
hm i thought the jre's did not include that. I can't test at this moment since i have the jdk installed but i'll take your word for it :P thanks.
Savvas Dalkitsis
Just got the 6u16 JRE installed (with the JDK of course), and verified its presence in rt.jar. Would suppose that is enough to verify :)
Vineet Reynolds
the question is if it will work for someone who only downloaded the jre (without the jdk). Maybe when downloading the jdk, these extra classes are available to the included jre...
Savvas Dalkitsis
Its in the separate JRE installation, not just in the embedded one. Besides it is pointless on Sun's part to release a JDK with transparency support in the JDK and not in the JRE. More details of the actual 'bug fix' can be found at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6633275 . You'll notice that it is against the consumer JRE.
Vineet Reynolds
thanks! :)
Savvas Dalkitsis
"Consumer JRE" was one of the many names used to describe what became 6u10.
Tom Hawtin - tackline