1
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?

4
  • No, that's the jre (Jave Runtime Environment), not the JDK. Related: stackoverflow.com/questions/5736641/… ... did you actually install the JDK? (Don't ask me why they package it like that) Commented Dec 24, 2012 at 15:57
  • I did install the jdk. But it still doesn't work. Commented Dec 24, 2012 at 17:00
  • Then you just have to set you JAVA_HOME correctly, not pointed at the JRE. The other answers to that question explain how. Commented Dec 24, 2012 at 17:03
  • I did that in the bash file but still the same error continues. Commented Dec 24, 2012 at 17:46

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

1 Comment

Don't install leiningen with the ubuntu package manager, just run the script from git. The apt version is still at 1.7.1. (never install packages without first checking if they are reasonably up-to-date).
0

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

1 Comment

With the "close as duplicate" function on SO you shouldn't copy/paste the solution from the one people mark as a duplicate ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.