Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I installed openjdk-7-jdk using apt-get install. However, when I type 'javac', the terminal says, 'bash: /usr/bin/javac: No such file or directory'. I think the link is broken, but how can I fix it?

Note: I installed openjdk-7-jdk before, but then I removed openjdk and installed sun-java. Now I deleted sun-jdk and want to go back to openjdk, but javac is not recognized. I'm using Ubuntu 11.10.

Edit: Recognized: java; Not Recognized: javac, javadoc, appletviewer, ...

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The following workaround worked for me:

sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-7-openjdk-amd64/bin/javac 1

Installing java on Ubuntu was much easier some years ago. I don't know why the hell the guys at Canonical make it more and more complex.

share|improve this answer
    
It is still easy, but if you follow some outdated blog on the internet and break it manually, it's your own fault... –  Lekensteyn Feb 2 '12 at 15:11
    
Sorry, but I did not follow any outdated blog. I just installed the JDK with apt-get install java7-jdk. –  Ethan Leroy Feb 4 '12 at 14:36
    
Did you mean openjdk-7-jdk? –  Lekensteyn Feb 4 '12 at 15:01
    
aptitude show java7-jdk tells State: not a real package and Provided by: openjdk-7-jdk. So, the answer is yes and no. –  Ethan Leroy Feb 6 '12 at 10:35
    
that looks like it works; I already reinstalled Ubuntu though –  functionptr Jun 26 '12 at 19:11

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.