New Feature of Coldfusion 10 Allows You to Dynamically Load Java Libraries

Java and Coldfusion 10 - Hostek

In the old days of ColdFusion if you wanted to access a 3rd party Java library (JAR or class files) you had a couple options:

1. Add the location of the library to the ColdFusion classpath
-or-
22. Use something like JavaLoader (http://javaloader.riaforge.org/) to dynamically load Java libraries into your ColdFusion application.

ColdFusion 10, however, makes it even easier to load Java libraries into your ColdFusion application without having to restart ColdFusion. All that’s required is your application define the ‘THIS.javaSettings’ attribute within the site’s Application.cfc like below:

[code]
<cfset THIS.javaSettings = {LoadPaths = [“/javafiles/”],reloadOnChange=true,watchInterval=30}/>
[/code]

The above code will check the “javafiles” directory in your Web root for ‘jar’ and ‘class’ files and make any libraries within the directory accessible from your ColdFusion application. ColdFusion will also check for changes to the files every 30 seconds and reload the libraries if it notices any changes to the files.

More info:

Adobe ColdFusion 10 Documentation – Using Java Classes: http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSe61e35da8d318518-106e125d1353e804331-7ffc.html

Tags:

Categories: