Re: access to java class objects

Hi Jan,

I would just do this:

Clazz = javax.swing.JLabel

Is this what you would like to do?

Cheers
Michael

On Mi 17/03/10 12:20 , Jan H. [email protected] wrote:

=> Class
does not work as expected.
Any suggestions?
Many TIA,
– Jan


To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email

---- Msg sent via @Mail - http://atmail.com/


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Also: javax.swing.JLabel.java_class

Thanks
–Vladimir

On Wed, Mar 17, 2010 at 12:37 PM, Michael J.
[email protected] wrote:

What is the jruby equivalent? Currently I do


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Many thanks for your quick response, Michael and Vladimir.

your answers do not give me the java class object. Try this:

irb(main):008:0> cls = Java::java.lang.Class.forName
“javax.swing.JLabel”
=> class javax.swing.JLabel
irb(main):009:0> cls.get_package
=> package javax.swing, Java Platform API Specification, version 1.6

Am 17.03.2010 um 12:42 schrieb Vladimir S.:

Also: javax.swing.JLabel.java_class

This looks good, but does somehow not return the java object for
javax.swing.JLabel.class

irb(main):010:0> cls = javax.swing.JLabel.java_class
=> class javax.swing.JLabel
irb(main):011:0> cls.get_package
NoMethodError: undefined method `get_package’ for class
javax.swing.JLabel:Java::JavaClass
from (irb):12

Clazz = javax.swing.JLabel

Is this what you would like to do?

No, cls now seems to be an alias for javax.swing.JLabel.

irb(main):012:0> cls = javax.swing.JLabel
=> Java::JavaxSwing::JLabel
irb(main):013:0> cls.get_package
NoMethodError: undefined method `get_package’ for
Java::JavaxSwing::JLabel:Class
from (irb):14

Any other ideas?

Cheers,
– Jan


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi Jan,

On Wed, Mar 17, 2010 at 1:22 PM, Jan H. [email protected]
wrote:

           from (irb):12

OK, how about his one:

irb > javax.swing.JLabel.to_java.get_package
=> package javax.swing, Java Platform API Specification, version 1.6

:slight_smile:

Thanks,
–Vladimir

No, cls now seems to be an alias for javax.swing.JLabel.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Am 17.03.2010 um 15:21 schrieb Vladimir S.:

   => class javax.swing.JLabel
   irb(main):011:0> cls.get_package
   NoMethodError: undefined method `get_package' for class javax.swing.JLabel:Java::JavaClass
           from (irb):12

OK, how about his one:

irb > javax.swing.JLabel.to_java.get_package
=> package javax.swing, Java Platform API Specification, version 1.6

this does not work here:

irb(main):019:0> Java::javax.swing.JLabel.to_java.get_package
NoMethodError: undefined method `get_package’ for
Java::JavaxSwing::JLabel:Class
from (irb):20
irb(main):020:0> VERSION
=> “1.8.7”
irb(main):021:0> JRUBY_VERSION
=> “1.5.0.dev”

Cheers,
– Jan

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Am 17.03.2010 um 22:23 schrieb Vladimir S.:

Weird. Works just fine here. Maybe, outdated JRuby 1.5.0dev? What
jruby -v does print for you?

It is a few days old:

$ jruby --version
jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-03-09 a659b27) (Java
HotSpot™ 64-Bit Server VM 1.6.0_17) [x86_64-java]

– Jan

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi,

On Wed, Mar 17, 2010 at 4:03 PM, Jan H. [email protected]
wrote:

irb(main):019:0> Java::javax.swing.JLabel.to_java.get_package
NoMethodError: undefined method `get_package’ for Java::JavaxSwing::JLabel:Class
from (irb):20
irb(main):020:0> VERSION
=> “1.8.7”
irb(main):021:0> JRUBY_VERSION
=> “1.5.0.dev”

Weird. Works just fine here. Maybe, outdated JRuby 1.5.0dev? What
jruby -v does print for you?

Thanks,
–Vladimir


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email