LastModified () java command not working in Clojure

I am trying to get the last modified time from a file in Clojure by running a Java command. Using java.io.File.lastModified, I should be able to get UNIX time, this does not work when running a script or in REPL.

My code: (java.io.File.lastModified "/home/lol/lolness.txt")

and my error: java.lang.ClassNotFoundException: java.io.File.lastModified (NO_SOURCE_FILE: 24)

(java.io.File.separator) works.

EDIT: Clojure version 1.2.0-master-SNAPSHOT OpenJDK Java Version 1.6.0

+3
source share
1 answer

lastModified - java.io.File. Clojure, :

(.lastModified (java.io.File. "/home/lol/lolness.txt"))

, clojure.contrib.java-utils (1.1)/clojure.java.io ( ) file, java.io.File . , :

(require '[clojure.java.io :as io])
(.lastModified (io/file "/home/lol/lolness.txt"))
+7

Source: https://habr.com/ru/post/1753073/


All Articles