本文介绍了如何识别在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

一般来说,(仅限CF10 + li>


通常可以,挑选一个类可能存在的所有版本的库,并检查它。对于该特定库,可能是一个不错的选择,因为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.

解决方案

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)

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:

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

08-27 17:15