Hick
Hick

Reputation: 36414

Build error while installing Clojure in Ubuntu.

Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/java-6-openjdk-i386/jre"

Erm.. But it is pointing to a JDK, open-JDK here. Am I missing out on something here?

Upvotes: 1

Views: 619

Answers (3)

Tim X
Tim X

Reputation: 4235

Ignore all solutions which suggest adding/setting a JAVA_HOME directory, they are wrong. If you have one set in your .profile etc, remove it.

Ubuntu (and a number of other distros, esp. debian based ones) use an 'alternatives' mechanism to provide a higher level of abstraction to handle things like multiple versions of the same software or multiple sotware packages which provide the same functionality, such as web browsers.

Ubuntu does not require a JAVA_HOME setting, provided you let the OS and it's packaging system manage your environment. If your manually installing things, your then on your own and need to work it out.

I suspect that originally, you only had the JRE installed, you then attempted to fix your problem by adding a JAVA_HOME setting and then later installed the required JDK. If this is the case, remove your JAVA_HOME setting and then use the update-alternatives command to make sure the correct java environment has been setup (see the man page for update-alternatives for details - its very easy).

The advice on using lein is IMO spot on and I would also recommend using the script rather than the packaged version. I would also recommend going witht he 2.0 preview version. It is quite stable and a better place to start than the older 1.x versions.

Upvotes: 1

Phil Lord
Phil Lord

Reputation: 3067

You could just install leiningen (which is packaged with Ubuntu). This will give you a nice project tool for working with Clojure. It bootstraps and pulls clojure in for you on a per package basis, which will also mean that you have more than one version.

Upvotes: 0

Sri Harsha Chilakapati
Sri Harsha Chilakapati

Reputation: 11950

Remove the jre part in the path. That should do the trick.

It would become

"/usr/lib/jvm/java-6-openjdk-i386"

Also as Brian suggested try

sudo apt-get install openjdk-7-jdk

Upvotes: 0

Related Questions