1

I'm trying to access the following static enum

public class Colors
{
    public enum ListofColors 
    {
        BLUE, RED, YELLOW
    }
}

But I keep getting the error

NameError: cannot load Java class Colors.Colors::ListofColors::BLUE

When I try the following:

CL = JavaUtilities.get_proxy_class('Colors.Colors::ListofColors::BLUE')

but then I tried the following:

CL = JavaUtilities.get_proxy_class('Colors.Colors')
red = Colors.Colors::ListofColors::RED

And it gave me the following error:

NameError: uninitialized constant Colors

Is there a different way to get this static enum from the jar file and include it in Jruby without getting that errpr?

Thanks.

Kalpesh Soni
  • 6,879
  • 2
  • 56
  • 59
hello_its_me
  • 743
  • 2
  • 19
  • 52

1 Answers1

0

I think you need package::class, you repeated Colors twice

also see

Problems Calling a Java Class from JRuby

figure out if java_import helps you https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby

Also you dont seem to be using the variable CL, Try using

CL::ListofColors::Blue

Community
  • 1
  • 1
Kalpesh Soni
  • 6,879
  • 2
  • 56
  • 59