Problems Including com.sun.awt.AWTUtilities class

I am having trouble including the com.sun.awt.AWTUtilities class on my
JRuby project. I need it to apply a transparency effect on a frame on my
desktop app. java_import and import give me this error

NameError: cannot load Java class com.sun.awt.AWTUtilities
get_proxy_or_package_under_package at
org/jruby/javasupport/JavaUtilities.java:54
method_missing at
/opt/jruby-1.6.0/lib/ruby/site_ruby/shared/builtin/javasupport/java.rb:51
(root) at test.rb:5

I have no idea about Java and very little JRuby, can anyone please help
me?

Thank you, Salvador.

I saw a reference to that class here:
http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/

This works for me:
jruby -rjava -e ‘p java_import com.sun.awt.AWTUtilities’
Java::ComSunAwt::AWTUtilities

It says in the article that you need to be running Java SE 6u10 or
higher. For me I am running u22:
java -version
java version “1.6.0_22”
Java™ SE Runtime Environment (build 1.6.0_22-b04-307-10M3261)
Java HotSpot™ 64-Bit Server VM (build 17.1-b03-307, mixed mode)

You might want to make sure you are running a version of Java which
has this feature (this is an optional “special” feature – which is
why it is under the ‘com.sun’ package space). Fortunately, Sun’s
hotspot JVM is the most common one…

-Tom

Tom, thank you very much. I had the right JVM installed, but it was not
selected as the dafault one. I corrected that and got the class working.

Again, thank you very much.

-Salvador

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs