简体   繁体   English

OpenJDK和Ubuntu Server

[英]OpenJDK and Ubuntu Server

This is more of a general question about OpenJDK and packages being removed. 这是关于OpenJDK和删除包的一般性问题。

I am removing libatk-wrapper-java . 我正在删除libatk-wrapper-java However when I use apt-get to remove it, it says openjdk-7-jre will also be removed. 但是,当我使用apt-get删除它时,它表示openjdk-7-jre也将被删除。 My question is, I am still able to use the java command successfully even after openjdk-7-jre was removed, how is this possible? 我的问题是,即使删除了openjdk-7-jre ,我仍然可以成功使用java命令,这怎么可能?

You can use this to find out where the Java command that's being used is located: 您可以使用它来查找正在使用的Java命令所在的位置:

which java

Then, use ls -l to find out if that's a symlink, and if so, where it points. 然后,使用ls -l来查明它是否是符号链接,如果是,则指出它指向的位置。 (There's a good chance it will point to something in /etc/alternatives , at least that's what it does on my system.) (很有可能它会指向/etc/alternatives某些东西,至少这是它在我的系统上的作用。)

Keep using ls -l to follow the links until you find the real binary that is being run. 继续使用ls -l跟踪链接,直到找到正在运行的真正二进制文件。

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. 这告诉我安装了openjdk-6-jre-headless软件包,这就是我在命令提示符下输入java时运行的Java二进制文件。 (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.) (但是你的系统上可能还有一个或多个其他JVM。这只是告诉我哪一个是默认的。)

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? 你有没有安装任何其他JDK? i'm using LINUx as-well and it came with openjdk-6. 我正在使用LINUx,它带有openjdk-6。 is that the case with you? 那是你的情况吗? check in /usr/share/doc/openjdk-6-jre 签入/ usr / share / doc / openjdk-6-jre

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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