unable to find javac compiler

189 views
Skip to first unread message

Thien

unread,
Nov 23, 2010, 5:00:05 PM11/23/10
to Hudson Users
I keep getting this error from running the tutorial test:

BUILD FAILED
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/jre"

I look at the JAVA argument in /etc/default/hudson and it says JAVA = /
usr/bin/java, which is a pointer pointing to /usr/lib/jvm/java-6-
openjdk/jre/bin/java, and this this folder (.../jre/bin), there's no
javac.
So I try to copy javac to this folder, but it still doesn't work.
I'm running out of knowledge and patience on this ... Please help !!

Gareth Bowles

unread,
Nov 23, 2010, 5:25:08 PM11/23/10
to hudson...@googlegroups.com
Looks like you're running on Linux; you need to install the openjdk-devel
package (e.g. yum install java-1.6.0-openjdk-devel on Red Hat or Fedora).

Gareth
--

Sami Tikka

unread,
Nov 23, 2010, 5:29:08 PM11/23/10
to hudson...@googlegroups.com
Install JDK. JRE does not come with javac. Hudson can do this for you in Manage Hudson => Configure System

You may need to change JAVA_HOME to point to install directory of JDK.

I know this info is very generic but so was your question. If you want more detailed advice, you need to tell details of your environment, like operating system and its version.

-- Sami
(sent from a phone, please excuse my brevity)

pcampbell

unread,
Nov 23, 2010, 5:32:15 PM11/23/10
to Hudson Users
It looks to me like your JAVA_HOME is pointing to the jre instead of
the jdk. What happens if you drop the trailing "/jre" from your
JAVA_HOME environment variable? (JAVA_HOME=/usr/lib/jvm/java-6-
openjdk)

Thien

unread,
Nov 23, 2010, 6:02:43 PM11/23/10
to Hudson Users
I'm running this on Ubuntu. The error said:

Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/java-6-openjdk/jre"

Does it mean JAVA_HOME is set to be "/usr/lib/jvm/java-6-openjdk/jre"
somewhere? I took a look at the file /etc/environment but didn't see
anything about JAVA_HOME ...

Thien

unread,
Nov 23, 2010, 6:07:15 PM11/23/10
to Hudson Users
Then I added the line JAVA_HOME = /usr/lib/jvm/java-6-openjdk and it
seems to work now. Thanks all !

But I still don't understand what's happening ...

Mykola Nikishov

unread,
Dec 25, 2010, 12:37:45 PM12/25/10
to hudson...@googlegroups.com
On 24.11.10 01:02, Thien wrote:

> I'm running this on Ubuntu. The error said:
>
> Perhaps JAVA_HOME does not point to the JDK.
> It is currently set to "/usr/lib/jvm/java-6-openjdk/jre"

You should install JDK and not JRE:

openjdk-6-jre-headless: /usr/lib/jvm/java-6-openjdk/bin/java
openjdk-6-jdk: /usr/lib/jvm/java-6-openjdk/bin/javac

> Does it mean JAVA_HOME is set to be "/usr/lib/jvm/java-6-openjdk/jre"
> somewhere? I took a look at the file /etc/environment but didn't see
> anything about JAVA_HOME ...

--
Mykola

Reply all
Reply to author
Forward
0 new messages