0

I want to try out Clojure and I'm having some trouble with the first step from here. It suggests using Leiningen to set up the Clojure project.

I download and run lein and I see this:

Error: dl failure on line 732
Error: failed /Library/Java/JavaVirtualMachines/OpenJDK-1.7.0-20110203.jdk/Contents/Home/jre/lib/client/libjvm.dylib, because dlopen(/Library/Java/JavaVirtualMachines/OpenJDK-1.7.0-20110203.jdk/Contents/Home/jre/lib/client/libjvm.dylib, 10): no suitable image found.  Did find:
    /Library/Java/JavaVirtualMachines/OpenJDK-1.7.0-20110203.jdk/Contents/Home/jre/lib/client/libjvm.dylib: mach-o, but wrong architecture

Through some research I've discovered that this copy of libjvm.dylib is built for x86. I suspect I need one that's built for x86_64. I've downloaded and installed a new jvm. You can see them here:

$ /usr/libexec/java_home -V
Matching Java Virtual Machines (7):
    1.7.0_b126+, x86_64:    "OpenJDK 7" /Library/Java/JavaVirtualMachines/OpenJDK-1.7.0-20110203.jdk/Contents/Home
    1.7.0_b126+, i386:  "OpenJDK 7" /Library/Java/JavaVirtualMachines/OpenJDK-1.7.0-20110203.jdk/Contents/Home
    1.7.0_12, x86_64:   "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_12.jdk/Contents/Home
    1.6.0_43-b01-447, x86_64:   "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    1.6.0_43-b01-447, i386: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    1.6.0_26-b03-383, x86_64:   "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0_26-b03-383.jdk/Contents/Home
    1.6.0_26-b03-383, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0_26-b03-383.jdk/Contents/Home

The copy of libjvm.dylib I want to use is in /Library/Java/JavaVirtualMachines/jdk1.7.0_12.jdk/...

But I don't know how to tell leiningen to use this. I actually don't think it's leiningen, but whatever that file is using to download something. And whatever this something is insists on using /Library/Java/JavaVirtualMachines/OpenJDK-1.7.0-20110203.jdk/, even if I change JAVA_HOME or rename this directory to /Library/Java/JavaVirtualMachines/jdk.old.foo.

munk
  • 12,340
  • 8
  • 51
  • 71

2 Answers2

0

Java 7 on the Mac is still pretty broken (at least for my purposes), and even having it on the machine can mess up the Apple provided Java 6 that normally works just fine. Remove all Java 7 installations (possibly log out/reboot) and then see if Java 6 will run (type java -version) from the command line. If you see something like this:

$ java -version
java version "1.6.0_43"
Java(TM) SE Runtime Environment (build 1.6.0_43-b01-447-11M4203)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01-447, mixed mode)

If you do, then you're good to go. After I removed JDK 7, I was able to continue on with my Clojure work on my mac.

Community
  • 1
  • 1
BillRobertson42
  • 12,602
  • 4
  • 40
  • 57
  • I didn't need to uninstall java 7 (yet), but I did link /usr/bin/java to java1.6 and then lein installed easily. – munk Mar 19 '13 at 04:01
  • Good to hear. There was something going on on my machine that interfered with Swing apps starting. Removing Java 7 (well, mostly) took care of that. – BillRobertson42 Mar 19 '13 at 04:30
-1

Double check these steps:

  1. Copy lein to /usr/bin/lein
  2. chmod 755 /usr/bin/lein
  3. lein repl
Héctor García
  • 738
  • 4
  • 9