Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
    
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. –  queueoverflow Nov 27 '11 at 13:11
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.