CFML and Java do not play together well with what you are trying to do.
I think it’s more that Lucee and Java don’t play nicely here.
This is a perfectly working version of the Java code in that StackOverflow
link http://stackoverflow.com/a/14455760/894061, in CFML:
dir = expandPath(“./”);
paths = createObject(“java”, “java.nio.file.Paths”);
p = paths.get(dir, []);
files = createObject(“java”, “java.nio.file.Files”);
linkOption = createObject(“java”, “java.nio.file.LinkOption”);
linkOptions = linkOption.values();
basicFileAttributeView = createObject(“java”,
“java.nio.file.attribute.BasicFileAttributeView”);
basicFileAttributeViewClass=basicFileAttributeView.getClass();
view = files.getFileAttributeView(p, basicFileAttributeViewClass,
linkOptions).readAttributes();
writeOutput(“#view.creationTime()# is the same as #view.lastModifiedTime()#”
);
I hasten to add my Java is fairly pedestrian, and this is just the result
of taking the code from StackOverflow and doing all the extra stuff CFML
needs to do the same thing. It might not be the best way to go about things.
On ColdFusion this outputs:
2015-08-21T07:52:50.951374Z is the same as 2015-08-21T07:53:03.644183Z
(that’s obviously nonsense, but it’s what the code is supposed to do)
On Lucee it errors cos one cannot call getClass() as indicated earlier.
:-/On Friday, 21 August 2015 08:30:17 UTC+1, Robert Munn wrote: