Use $ to Instantiate Java Nested Static Classes in ColdFusion

Ok, so this isn't news; apparently its common knowledge to some that you can instantiate a nested Java class by using a $ instead of a . in the name:

<cfset local.RoundRectangle2D = CreateObject("java", "java.awt.geom.RoundRectangle2D$Float") />

I'm posting this because I found it impossible to locate this information on the web. I even had an Adobe tech tell me he was logging a bug that CF couldn't handle nested classes, because even he didn't seem to know that you could do this. Its now in the CF8 LiveDocs, and its now on my website. Perhaps the next person in line will be able to find it easier.

 

Comments

Jon Hartmann, July 2011

I'm Jon Hartmann and I'm a Javascript fanatic, UX/UI evangelist and former ColdFusion master. I blog about mysterious error messages, user interface design questions, and all things baffling and irksome about programming for the web.

Learn more about me.

Post a job. Find one. authenticjobs.com

Interested in becoming a sponsor? Contact me.