I have a Debian Unstable VM which I used to package a Java project before. Today, the javac was gone somehow, so I installed default-jdk again. But still, there is no javac.

What could I do?

2 Answers 2


javac is managed by the alternatives system. /usr/bin/javac is a symbolic link to /etc/alternatives/javac which is a symbolic link to one of the Java compilers you have installed. The default-jdk package depends on openjdk-6-jdk which provides /usr/lib/jvm/java-6-openjdk-i386/bin/javac (on i386). This file is what /etc/alternatives/javac should link to. If it doesn't, run

update-alternatives --config javac

to configure the target of /etc/alternatives/javac interactively, or update-alternatives --auto javac to reset it to its default value.

  • 1
    I tried running update-alternatives --config javac, but it gave me update-alternatives: error: no alternatives for javac.. I just created the symlink by hand. Nov 27, 2011 at 13:11

Check your $PATH environment variable to check if it contains /usr/lib/java/bin or /usr/lib64/java/bin on x86_64 systems. This variable is usually when you log in set via a shell script that the jdk package installs; it may help to log out and back in again. Check the value of $JAVA_HOME.

If your PATH does contain the path I mentioned, and type javac still doesn't give you anything, then try typing locate bin/javac and see what that returns. You may have to run sudo updatedb or sudo locate -u beforehand, if you just installed the package, so that the slocate database is up do date.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .