Aptitude

這是什麼魔法?能力傾向搜尋“?提供(java-runtime)”

  • October 6, 2015

我正在查找如何在 Debian 上正確安裝 java。來到 Debian wiki(這是我在 Debian 上真正欣賞的一件事,wiki 很棒),這是我得到的提示:

只需aptitude search "?provides(java-runtime)"在您的系統上執行以列出可用的軟體包)。

所以我認為這?provides是描述中的一些查詢,但請注意:

i A default-jre                 - Standard Java or Java compatible Runtime                                                         
p   default-jre:i386            - Standard Java or Java compatible Runtime                                                         
i A default-jre-headless        - Standard Java or Java compatible Runtime (headless)                                              
p   default-jre-headless:i386   - Standard Java or Java compatible Runtime (headless)                                              
p   gcj-4.8-jre                 - Java runtime environment using GIJ/Classpath                                                     
p   gcj-4.8-jre:i386            - Java runtime environment using GIJ/Classpath                                                     
p   gcj-4.8-jre-headless        - Java runtime environment using GIJ/Classpath (headless version)                                  
p   gcj-4.8-jre-headless:i386   - Java runtime environment using GIJ/Classpath (headless version)                                  
p   gcj-4.9-jre                 - Java runtime environment using GIJ/Classpath                                                     
p   gcj-4.9-jre:i386            - Java runtime environment using GIJ/Classpath                                                     
p   gcj-4.9-jre-headless        - Java runtime environment using GIJ/Classpath (headless version)                                  
p   gcj-4.9-jre-headless:i386   - Java runtime environment using GIJ/Classpath (headless version)                                  
p   gcj-jre                     - Java runtime environment using GIJ/Classpath                                                     
p   gcj-jre:i386                - Java runtime environment using GIJ/Classpath                                                     
p   gcj-jre-headless            - Java runtime environment using GIJ/Classpath (headless version)                                  
p   gcj-jre-headless:i386       - Java runtime environment using GIJ/Classpath (headless version)                                  
i A openjdk-7-jre               - OpenJDK Java runtime, using Hotspot JIT                                                          
p   openjdk-7-jre:i386          - OpenJDK Java runtime, using Hotspot JIT                                                          
i A openjdk-7-jre-headless      - OpenJDK Java runtime, using Hotspot JIT (headless)                                               
p   openjdk-7-jre-headless:i386 - OpenJDK Java runtime, using Hotspot JIT (headless)                

該字元串java-runtime從未出現在輸出中,這表明正在查詢隱藏的屬性。這些是哪些?

每個包都有不同的欄位。您會看到列出的包名稱和簡短描述,但查詢Provides-field。

您可以列出包的所有可用版本的所有欄位

$ apt-cache show openjdk-7-jre

並獲取(縮短,取決於您的系統:)

[...]

Package: openjdk-7-jre
Source: openjdk-7
Version: 7u3-2.1.7-1
[...]
Architecture: amd64
Provides: java-runtime, java2-runtime, java5-runtime, java6-runtime, java7-runtime
Depends: openjdk-7-jre-headless (= 7u3-2.1.7-1), libasound2 (>= 1.0.16), libatk1.0-0 (>= 1.12.4), libc6 (>= 2.11), libcairo2 (>= 1.2.4), libcups2 (>= 1.4.0), libfontconfig1 (>= 2.9.0), libfreetype6 (>= 2.2.1), libgdk-pixbuf2.0-0 (>= 2.22.0), libgif4 (>= 4.1.4), libglib2.0-0 (>= 2.16.0), libgtk2.0-0 (>= 2.8.0), libjpeg8 (>= 8c), libpango1.0-0 (>= 1.14.0), libpng12-0 (>= 1.2.13-4), libpulse0 (>= 0.99.1), libx11-6, libxext6, libxi6, libxrender1, libxtst6, zlib1g (>= 1:1.1.4), libxrandr2, libxinerama1, libgl1-mesa-glx | libgl1, libatk-wrapper-java-jni (>= 0.30.4-0ubuntu2)
Recommends: libgnome2-0, libgnomevfs2-0, libgconf2-4, ttf-dejavu-extra
Suggests: icedtea-7-plugin
Conflicts: icedtea-gcjwebplugin (<< 1.0-1ubuntu4)
Description-en: OpenJDK Java runtime, using Hotspot JIT
Full Java runtime environment - needed for executing Java GUI and Webstart
programs. Using Hotspot JIT.
The packages are built using the IcedTea build support and patches
from the IcedTea project.
[...]

關於列出的文件:

  • :i386表示該軟體包適用於i386架構(不是amd64您可能正在使用的)
  • headless沒有圖形顯示的系統的手段(較少的依賴關係)
  • gcjgcc項目中的 java 執行時
  • openjdk是您可能想要使用的更官方的免費 java 實現

另請參閱https://askubuntu.com/questions/377750/what-is-the-difference-between-default-jdk-ecj-gcj-and-openjdk

引用自:https://unix.stackexchange.com/questions/234213