简体   繁体   中英

OpenJDK and Ubuntu Server

This is more of a general question about OpenJDK and packages being removed.

I am removing libatk-wrapper-java . However when I use apt-get to remove it, it says openjdk-7-jre will also be removed. My question is, I am still able to use the java command successfully even after openjdk-7-jre was removed, how is this possible?

You can use this to find out where the Java command that's being used is located:

which java

Then, use ls -l to find out if that's a symlink, and if so, where it points. (There's a good chance it will point to something in /etc/alternatives , at least that's what it does on my system.)

Keep using ls -l to follow the links until you find the real binary that is being run.

Then, use this to find out what package owns the binary:

dpkg -S $PATH_TO_JAVA_BINARY

On my machine, this process looks like this:

AWS:~$ which java
/usr/bin/java
AWS:~$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Jul 30 22:47 /usr/bin/java -> /etc/alternatives/java*
AWS:~$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 45 Jul 30 22:47 /etc/alternatives/java -> /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java*
AWS:~$ dpkg -S /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java
openjdk-6-jre-headless: /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java

This tells me that the package openjdk-6-jre-headless is installed, and that's what owns the Java binary that is run when I type java at the command prompt. (There still might be one or more other JVM's on your system, though. This is only telling me which one will be the default.)

This might not be the fastest way to answer your question, but it will hopefully help you understand your system setup a little better.

do you have any other JDK's installed? i'm using LINUx as-well and it came with openjdk-6. is that the case with you? check in /usr/share/doc/openjdk-6-jre

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM