将 Java 文件包含到 Coldfusion 中

2022-01-09 00:00:00 coldfusion java jar coldfusion-9

如何将 jar/java 文件包含到我的 Coldfusion 项目中.目前我正在使用这一行进入我 <cfscript>

How can I include jar/java files into my coldfusion project. currently I am using this line into me <cfscript>

我的目录是这样的

website_name
         |__ Login
             |__ connection
                |__ display.cfm
                |__ twitter
                    |__ com
                        |__ ConfigurationBuilder.java

在我的 display.cfm 文件中,我在这样的脚本中调用 obj

in my display.cfm file I am calling obj in script like this

<cfscript>
    configBuilder = createObject("java", "twitter.com.ConfigurationBuilder");
</cfscript>

但是当我运行 display.com 并且错误是这样的

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");

如何调用我的 java 类以及如何调用它的函数以便我可以调用我的 twitter 函数.

How can I call my java class and how to call its function so that I can call my twitter function.

推荐答案

将类或 jar 文件添加到类路径的最简单方法是简单地将它们放到 lib 目录中,它们会自动被拾取.该目录位于 {cf_installation}/servers/lib.这些类文件将可供所有服务器使用.

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

相关文章