A
Andrew
I have a class 'some.package.ClassName'. I have the string
"some.package.classname", all in lowercase, with no way of knowing how
to restore the correct case to the class name. I need to instantiate
the 'some.package.ClassName' class.
Is there a case-insensitive way to get a object instance from an all
lowercase String containing the fully-qualified class name?
I note that when I try:
Class c = Class.forName("some.package.classname");
it naturally throws a java.lang.NoClassDefFoundError (because of the
case-sensitivity).
The exact error is: java.lang.NoClassDefFoundError:
some/package/classname (wrong name: some/package/ClassName)
With interest, I note that the "wrong name" value also reported with
the exception contains the correct case.
Where does this "wrong name" value come from? How does it restore the
case correctly? (This is exactly what I want to do - I really want the
'wrong name' value from the java.lang.NoClassDefFoundError exception).
Any suggestions?
Thanks,
Andrew
"some.package.classname", all in lowercase, with no way of knowing how
to restore the correct case to the class name. I need to instantiate
the 'some.package.ClassName' class.
Is there a case-insensitive way to get a object instance from an all
lowercase String containing the fully-qualified class name?
I note that when I try:
Class c = Class.forName("some.package.classname");
it naturally throws a java.lang.NoClassDefFoundError (because of the
case-sensitivity).
The exact error is: java.lang.NoClassDefFoundError:
some/package/classname (wrong name: some/package/ClassName)
With interest, I note that the "wrong name" value also reported with
the exception contains the correct case.
Where does this "wrong name" value come from? How does it restore the
case correctly? (This is exactly what I want to do - I really want the
'wrong name' value from the java.lang.NoClassDefFoundError exception).
Any suggestions?
Thanks,
Andrew