问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/35700231/how-to-identify-what-version-jar-is-running-under-coldfusion