Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何从 ColdFusion 访问 Java 类的公共静态成员?
您运行 createObject 但在运行静态方法之前不调用“init”。例如:
<cfset systemObject = createObject("java", "java.lang.System") /> <cfoutput>#systemObject.currentTimeMillis()#</cfoutput>
在这种情况下,“currentTimeMillis()”是 System 类的静态方法。
我还要提到该类必须在 CF 的类路径中。