简体   繁体   English

由于未找到 Java 类异常,leiningen 无法运行

[英]leiningen cannot run because of java class not found exception

I recently--as in, today--became interested in learning to program with clojure.我最近——就像今天一样——对学习使用 clojure 编程产生了兴趣。 Now after having installed the latest version of java's jdk and downloading the leiningen script, I followed the installation instructions for the latter, specifically those given at: http:/www.lispcast.com/clojure-ubuntu .现在,在安装了最新版本的 java 的 jdk 并下载了 leiningen 脚本之后,我按照后者的安装说明进行操作,特别是在以下位置给出的说明: http:/www.lispcast.com/clojure-ubuntu

Now, after the running lein version and downloading the relevant jar file, the program exits with an error about a class not being found.现在,在运行lein version并下载相关 jar 文件后,程序退出并显示未找到类的错误。 The error in question reads as follows:有问题的错误如下:

Exception in thread "main" java.lang.ExceptionInInitializerError线程“main”中的异常 java.lang.ExceptionInInitializerError
at java.base/java.lang.Class.forName0(Native Method)在 java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)>在 java.base/java.lang.Class.forName(Class.java:375)>
at clojure.lang.RT.classForName(RT.java:2168)在 clojure.lang.RT.classForName(RT.java:2168)
at clojure.lang.RT.classForName(RT.java:2177)在 clojure.lang.RT.classForName(RT.java:2177)
at clojure.lang.RT.loadClassForName(RT.java:2196)在 clojure.lang.RT.loadClassForName(RT.java:2196)
at clojure.lang.RT.load(RT.java:443)在 clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:419)在 clojure.lang.RT.load(RT.java:419)
at clojure.core$load$fn__5677.invoke(core.clj:5893)在 clojure.core$load$fn__5677.invoke(core.clj:5893)
at clojure.core$load.invokeStatic(core.clj:5892)在 clojure.core$load.invokeStatic(core.clj:5892)
at clojure.core$load.doInvoke(core.clj:5876)在 clojure.core$load.doInvoke(core.clj:5876)
at clojure.lang.RestFn.invoke(RestFn.java:408)在 clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core__init.load(Unknown Source)在 clojure.core__init.load(未知来源)
at clojure.core__init.(Unknown Source)在 clojure.core__init.(来源不明)
at java.base/java.lang.Class.forName0(Native Method)在 java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)在 java.base/java.lang.Class.forName(Class.java:375)
at clojure.lang.RT.classForName(RT.java:2168)在 clojure.lang.RT.classForName(RT.java:2168)
at clojure.lang.RT.classForName(RT.java:2177)在 clojure.lang.RT.classForName(RT.java:2177)
at clojure.lang.RT.loadClassForName(RT.java:2196)在 clojure.lang.RT.loadClassForName(RT.java:2196)
at clojure.lang.RT.load(RT.java:443)在 clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:419)在 clojure.lang.RT.load(RT.java:419)
at clojure.lang.RT.doInit(RT.java:461)在 clojure.lang.RT.doInit(RT.java:461)
at clojure.lang.RT.(RT.java:331)在 clojure.lang.RT.(RT.java:331)
at clojure.main.(main.java:20)在 clojure.main.(main.java:20)
Caused by: java.lang.ClassNotFoundException: java/sql/Timestamp引起:java.lang.ClassNotFoundException:java/sql/Timestamp
at java.base/java.lang.Class.forName0(Native Method)在 java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)在 java.base/java.lang.Class.forName(Class.java:375)
at clojure.lang.RT.classForName(RT.java:2168)在 clojure.lang.RT.classForName(RT.java:2168)
at clojure.lang.RT.classForNameNonLoading(RT.java:2181)在 clojure.lang.RT.classForNameNonLoading(RT.java:2181)
at clojure.instant$loading__5569__auto____6869.invoke(instant.clj:9)在 clojure.instant$loading__5569__auto____6869.invoke(instant.clj:9)
at clojure.instant__init.load(Unknown Source)在 clojure.instant__init.load(未知来源)
at clojure.instant__init.(Unknown Source)在 clojure.instant__init.(来源不明)
... 23 more ……还有 23 个

My java 9 jdk is installed in /usr/lib/jvm/java-9-oracle/bin/java , with my JAVA_HOME variable set to /usr/lib/jvm/java-9-oracle but I tried /usr/lib/jvm/java-9-oracle/bin as well, just in case.我的 java 9 jdk 安装在/usr/lib/jvm/java-9-oracle/bin/java ,我的JAVA_HOME变量设置为/usr/lib/jvm/java-9-oracle但我试过/usr/lib/jvm/java-9-oracle/bin也是如此,以防万一。 I am running xubuntu 16.04.3, if this is of any importance.我正在运行 xubuntu 16.04.3,如果这很重要的话。 I did try setting the default java jdk back to the openjdk which is bundled with xubuntu but this also was to no avail.我确实尝试将默认的 java jdk 设置回与 xubuntu 捆绑在一起的 openjdk,但这也无济于事。

As an aside, the entire problem originated because I tried running the REPL in intellij after installing the cursive plugin, which didn't work.顺便说一句,整个问题源于我在安装草书插件后尝试在 intellij 中运行 REPL,但没有奏效。 I then surmised that it might be because I had not installed leiningen beforehand (I thought that the IDE and cursive would have this bundled along).然后我推测这可能是因为我没有事先安装 leiningen(我认为 IDE 和草书会把它捆绑在一起)。 However, the actual information on what intellij and clojure require to run successfully has eluded me, since much of the information is rather 'scattered' and I'm not sure whether I missed something along the way.然而,关于 intellij 和 clojure 需要什么才能成功运行的实际信息让我望而却步,因为大部分信息相当“分散”,我不确定我是否在此过程中遗漏了什么。

In any case, I am having quite a hard time of getting everything to work--probably because I'm not yet that savvy when it comes to these kinds of issues, having only been on a linux distro for a short while as well as being completely unfamiliar with clojure.无论如何,我很难让一切正常工作——可能是因为我在处理这些问题时还不是那么精明,只在 Linux 发行版上工作过一段时间完全不熟悉clojure。 If I'm missing something obvious, I apologize, but it stands to reason that something can only be obvious once it is shown to be so.如果我遗漏了一些明显的东西,我深表歉意,但有理由认为某些东西只有被证明是显而易见的。

Any and all suggestions will be greatly appreciated.任何和所有建议将不胜感激。

That looks like a problem caused by Java 9's new concept of "modules": Clojure expects to be able to access java.sql.Timestamp, but it can't.这看起来像是由 Java 9 的“模块”新概念引起的问题:Clojure 希望能够访问 java.sql.Timestamp,但它不能。 I haven't kept up with Java development or Clojure development, so I can't say for sure that's your problem, but it looks that way to me.我没有跟上 Java 开发或 Clojure 开发,所以我不能肯定这是你的问题,但在我看来是这样的。 Try with an earlier JDK.尝试使用较早的 JDK。

If you cant downgrade your JAVA version, run lein upgrade 2.8.1 or the latest Leiningen would do.如果你不能降级你的 JAVA 版本,运行 lein upgrade 2.8.1 或者最新的 Leiningen 就可以了。 Leiningen has been updated to include support for Java 9. Leiningen 已更新以包含对 Java 9 的支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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