This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-02
Channels
- # beginners (26)
- # bitcoin (1)
- # boot (9)
- # boot-dev (5)
- # cider (26)
- # cljs-dev (1)
- # clojure (190)
- # clojure-finland (1)
- # clojure-italy (42)
- # clojure-nl (20)
- # clojure-russia (3)
- # clojure-sanfrancisco (1)
- # clojure-serbia (1)
- # clojure-spec (50)
- # clojure-uk (16)
- # clojurescript (62)
- # core-async (4)
- # cryogen (1)
- # cursive (6)
- # datascript (1)
- # datomic (36)
- # duct (6)
- # editors (6)
- # emacs (14)
- # graphql (3)
- # leiningen (30)
- # off-topic (21)
- # om (7)
- # parinfer (13)
- # portkey (56)
- # re-frame (2)
- # reagent (2)
- # shadow-cljs (58)
- # vim (1)
- # yada (3)
Should leiningen 2.8.1 work with JDK 9 & 10 on Linux?
I am getting "Java compiler not found; Be sure to use java from a JDK rather than a JRE by modifying PATH or setting JAVA_CMD." on a project with Java in it.
(This is Fedora 28)
More info - in JShell I get this: jshell> ToolProvider.getSystemJavaCompiler() $2 ==> com.sun.tools.javac.api.JavacTool@271053e1 But in lein repl, this: user=> (javax.tools.ToolProvider/getSystemJavaCompiler) nil JDK 1.8.0 is OK, so I've switched to that.
@peterhull90 I haven’t tried and it’s not immediately clear from this thread; https://github.com/technomancy/leiningen/issues/2149
From the news I would assume there’s some compatibility so it might be down to the specific plugins you’re using. https://github.com/technomancy/leiningen/blob/master/NEWS.md
Thanks @nfisher! I did see that bug and it looked different to what I'm seeing. I admit I didn't spend long but it seemed like lein basically worked with JDK9/10 (lein repl was fine, etc.) but could not invoke javac. I cannot believe I'm the only person to have tried it, so, you may well be right to suggest it's something to do with my plugins. Will investigate further.
I am fairly sure I have JDK10 installed:
[peter@dell ~]$ dnf list installed |grep java-openjdk java-openjdk.x86_64 1:10.0.0.46-10.fc28 @updates java-openjdk-devel.x86_64 1:10.0.0.46-10.fc28 @updates java-openjdk-headless.x86_64 1:10.0.0.46-10.fc28 @updates [peter@dell ~]$ javac -version javac 10
Also I don't understand why javax.tools.ToolProvider.getSystemJavaCompiler returns an instance of com.sun.tools.javac.api.JavacTool in jshell and nil in lein repl
Well, it is possible you have the two tools configured to a different location of the jdk vs jre, but I’m not sure what may be the issue
perhaps set JAVA_CMD
for lein
to whatever the jshell
is using to be sure that isn’t the case
I'm thinking it's a module thing - the javadocs say it might return null if jdk.compiler module is not available: https://docs.oracle.com/javase/10/docs/api/javax/tools/ToolProvider.html#getSystemJavaCompiler() so may be some way to specify java modules to lein?
I’m not sure at what level of lein you are seeing the problem, but there are ways to give jvm args
for jvm options for your own project, you can add :jvm-opts ["--add-modules" "the.module.you.need.here"]
that may be all you need, if you know what module the java compiler is in that you need
if it more at a lein
s own jvm process level, then you can look into the JVM_OPTS
environment variable or LEIN_JVM_OPTS
, I’m not sure the difference offhand, both are referenced in the sample project here https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L515
Thanks. I am at home now but I will try those various options tomorrow at work. I feel I don't really understand java any more...
post 1.8
I haven’t done much with Java 9+ yet. I’ll be surprised if you have found a lein
config issue with a new jdk that no one else had for some reason.
A lot of lein
stuff had issues at first with it trying to load stuff on the bootclasspath and also some dependencies on some now-not-auto-included jdk modules around xml bindings
Yes, I am sure the problem is more likely to be at my end than something wrong with Fedora or Java or Leiningen. I was hoping someone here would have come across it already and know the answer!
Success \o/
I solved my problem by using the 'alternatives' utility to set the 'java' alternative to Java 10 - it was set to 1.8, even though 'javac' and 'java_sdk_openjdk' were set to Java 10. This seems to have caused confusion.
Also I don't understand why javax.tools.ToolProvider.getSystemJavaCompiler returns an instance of com.sun.tools.javac.api.JavacTool in jshell and nil in lein repl
I solved my problem by using the 'alternatives' utility to set the 'java' alternative to Java 10 - it was set to 1.8, even though 'javac' and 'java_sdk_openjdk' were set to Java 10. This seems to have caused confusion.