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.

This question already has an answer here:

I'm install OpenJDK Java on my Ubuntu 12.04 desktop using the following command:

sudo apt-get install openjdk-7-jdk

But I keep having java not found:

The program 'java' can be found in the following packages:
 * default-jre
 * gcj-4.6-jre-headless
 * openjdk-6-jre-headless
 * gcj-4.5-jre-headless
 * openjdk-7-jre-headless
Try: sudo apt-get install <selected package>

What's the reason here? I tried reinstall, even deleting /usr/lib/jvm but it still doesn't work.

There is no java in /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin, only javac and other things. Also when I run javac, this is the error:

javadoc: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory
share|improve this question

marked as duplicate by Radu Rădeanu, Eric Carvalho, AgentCool, Seth, Stephen Myall Jun 27 '13 at 15:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
The last line, Try: sudo apt-get install <selected package>, doesn't say nothing? –  Radu Rădeanu Jun 25 '13 at 15:30
    
I thought I should have java after installing openjdk-7-jdk? They are the other packages? –  Dzung Nguyen Jun 25 '13 at 15:31
    
I installed java perfectly on my laptop (with a clean ubuntu installation). I guess my desktop has some missing things, so there's a lot of errors. –  Dzung Nguyen Jun 25 '13 at 15:41

1 Answer 1

To install OpenJDK Java 7 Runtime, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

sudo apt-get install openjdk-7-jre

The openjdk-7-jre package contains just the Java Runtime Environment. If you want to develop Java programs then install the openjdk-7-jdk package afterwards. Then you can do

sudo apt-get install icedtea6-plugin
share|improve this answer

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