How can I include jar/java files into my coldfusion project.
currently I am using this line into me <cfscript>
Me directory is looks like this
website_name
|__ Login
|__ connection
|__ display.cfm
|__ twitter
|__ com
|__ ConfigurationBuilder.java
in my display.cfm
file I am calling obj in script like this
<cfscript>
configBuilder = createObject("java", "twitter.com.ConfigurationBuilder");
</cfscript>
but it gives me error on this line when I run display.com
and error is this
An exception occurred while instantiating a Java object. The class must not be
an interface or an abstract class. Error: ''.
The error occurred in website_name/login/azam/connection/display.cfm: line 57
57 : configBuilder = createObject("java", "twitter.com.ConfigurationBuilder");
How can I call my java class and how to call its function so that I can call my twitter function.
ColdFusion 9 here:
wwwroot/WEB-INF/lib
wwwroot/WEB-INF/classes
(classmypackage.myClass
goes into subdirectorymypackage
)If you're using ColdFusion 10 you can use the newly built in feature to dynamically load Java Files:
Specifying custom Java library path in the Application.cfc
As surfealokesea said in their answer:
You can also make your class files available only to the ColdFusion server by dropping them in
(Note that putting them in {cf_installation}/servers/default/cfmx/WEB-INF/cfusion/lib will NOT work.)
The easiest way to add class or jar files to your class path is to simply drop them in the lib directory where they are automatically picked up. The directory is located at {cf_installation}/servers/lib. These class files will be available to all servers.
http://blogs.adobe.com/cantrell/archives/2004/07/the_definitive.html