如何识别在ColdFusion下运行的是什么版本的jar [英] How to identify what version jar is running under ColdFusion

查看:573
本文介绍了如何识别在ColdFusion下运行的是什么版本的jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将jar文件更新到coldfusion安装的最新版本?我可以看到jar文件,用不同的版本,在不同的位置。如何确认当前运行的jar版本和ColdFusion查找这些jar的位置?



例如,在 coldfusion \lib 我有这些jar:




  • commons-collections.jar

  • 3.1.jar

  • commons-collections.3.2.jar



> \Coldfusion\ffusion\lib ,我有:




  • commons-collections.jar



感谢您提供任何帮助或建议。

解决方案

block

一般来说, ColdFusion在以下位置搜索jars:






当前正在运行的jar版本


通常可以识别源jar ,挑选一个类可能存在的所有版本的库,并检查它 Class.getResource()。对于该特定库, CollectionUtils 可能是一个不错的选择,因为API说它自从1.0版本开始存在。

  //创建实例
testClass = createObject(java,org.apache.commons.collections.CollectionUtils ).getClass();
//将类名转换为格式:/path/to/TheClassName.class
className =/& replace(testClass.name,。,/,all)&。
//显示位置,如果未知
,则为nulllocation = testClass.getResource(className);
writeOutput(isNull(location)?null:location.toString());

结果显然会有所不同,但是在安装ColdFusion 11后,

commons-collections-3.2.1.jar !/ org / apache / commons / collections / CollectionUtils.class



How can I update the jar files to the latest version which comes with coldfusion installation? I can see jar files, with different versions, under different locations. How can I confirm which version of the jar is currently running and what are the locations ColdFusion looks for these jars?

For example, in coldfusion\lib I have these jars:

  • commons-collections.jar
  • commons-collections.3.1.jar
  • commons-collections.3.2.jar

Then in another location \Coldfusion\cfusion\lib, I have:

  • commons-collections.jar

Thanks in advance for any help or suggestions.

解决方案

what are the locations coldfusion looks for these jars

Generally, ColdFusion searches the following locations for jars:

  • ColdFusion Class Path (See ColdFusion Administrator > Server Settings > Java & JVM).
  • Default JVM class path
  • Dynamic paths specified in THIS.javaSettings (CF10+ only)

what version of the jar in currently running

Usually you can identify the source jar by picking a class likely to exists all versions of that library and checking it with Class.getResource(). For that specific library, CollectionUtils would probably be a good choice, since the API says it has existed since version 1.0.

 // Create instance
 testClass = createObject("java", "org.apache.commons.collections.CollectionUtils").getClass();
 // Convert class name to format:  /path/to/TheClassName.class 
 className = "/"& replace( testClass.name, ".", "/", "all") &".class";
 // Display location, or "null" if unknown
 location = testClass.getResource( className );
 writeOutput(  isNull(location) ? "null" : location.toString());

The results will obviously vary, but with my ColdFusion 11 install, the above returns:

org/apache/commons/collections/CollectionUtils.class jar:file:/c:/ColdFusion/cfusion/lib/commons-collections-3.2.1.jar!/org/apache/commons/collections/CollectionUtils.class

这篇关于如何识别在ColdFusion下运行的是什么版本的jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆