All Collections
Per-Application Custom Java Libraries in ColdFusion
Per-Application Custom Java Libraries in ColdFusion
Updated over a week ago


Adobe ColdFusion makes it easy to load Java libraries into your ColdFusion application without the need to restart the ColdFusion service at the service level. This feature also allows you to have unique Java libraries between applications that is not being utilized at the server level.

Loading a Custom Java Library into your ColdFusion application: 

You can easily import Java libraries into your live production application by defining "THIS.javaSettings" within the website’s Application.cfc file. The following code snippet can be specified within your Application.cfc to import your custom Java library or libraries. 

<cfset THIS.javaSettings = {LoadPaths = ["/javafiles/"], loadColdFusionClassPath = true, reloadOnChange=false}/>

 After you’ve defined your Java library within your Application.cfc file you will need to perform a restart of ColdFusion in order for your application to load the Java library. If you’re on a shared ColdFusion hosting packages with us you will need to perform a manual restart of your ColdFusion application. This can be done by creating a restart.cfm file within your website’s root and placing the following code within this file:

<cfset ApplicationStop() />
<cflocation url="index.cfm" addtoken="false" />

When you run the restart script, your ColdFusion application will be stopped (flushing your application scope), and when the browser is redirected to the index page the application will start again.

Congratulations! You have imported a custom Java library into your ColdFusion application. If you have any issues with this process, then our world-class team of ColdFusion experts can help. 

Did this answer your question?