简体   繁体   中英

All versions of Clojure jars report to be Clojure-1.7.0-RC1, regardless of actual version

When I download a copy of Clojure ( 1.8.0 or any other version), either from Maven Central or the official website, it will claim to be version 1.7.0-RC1 .

For example:

$ java -jar clojure-1.8.0.jar Clojure 1.7.0-RC1 user=>

It also seems that this is, in fact, the version that is run. Since functions that were added in 1.8.0 (specifically string/starts-with? ) are not available in the repl (after importing).

When an identical copy of the file (verified by shasum) is downloaded on a separate laptop, the correct version runs.

I have verified this with several versions, including 1.8.0 , 1.9.0-alpha17 , and 1.5.0-RC2 . All of them report as 1.7.0-RC1 .

Additional information:

$ java -version Java(TM) SE Runtime Environment (build 1.8.0_60-b27) Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

Using macOS version 10.12.3 .

Another (older) version of Clojure .jar may load and override the one specified on command line (or classpath), if you have installed the older Clojure 1.7.0-RC1 as a "Java Extension" on macOS . In practise, your reported behaviour results from placing the 1.7.0 .jar in /Library/Java/Extensions/ or ~/Library/Java/Extensions/ (under your home directory).

A simple solution is to remove the jar file from the Extensions folder.

The Java Development Guide for Mac actually warns about the perils of using the Extensions directory, as it can lead to such problems:

Try to include all of your dependent libraries in your application rather than relying on the Java Extensions directory, because its contents are unversioned and cannot accommodate for multiple versions of the same library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM