简体   繁体   中英

How can I access a public static member of a Java class from ColdFusion?

如何从ColdFusion访问Java类的公共静态成员?

You run the createObject but don't call the "init" before running the static method. For example:

<cfset systemObject = createObject("java", "java.lang.System") />
<cfoutput>#systemObject.currentTimeMillis()#</cfoutput> 

In this case "currentTimeMillis()" is a static method of the System class.

我还要提到该类必须在CF的类路径中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM