Questo breve tutorial ti insegnerà come installare Oracle Java 10 in Arch Linux e suoi derivati come Antergos e Manjaro Linux ecc. Possiamo installare Oracle Java sia dal sorgente che utilizzando qualsiasi programma di supporto AUR, ad esempio Sì . Tuttavia, l'installazione di Java utilizzando l'helper Yay AUR è il modo più semplice e veloce. Cominciamo.
Aggiorna prima il tuo sistema Arch Linux usando il comando:
$ sudo pacman -Syu
Quindi, installa Yay se non l'hai ancora installato come descritto nel seguente link.
- Sì, un altro affidabile aiutante AUR scritto in movimento
Installa Oracle Java 10 in Arch Linux
Dopo aver installato Yay, cerca le versioni Java disponibili.
Cerca le versioni Java di Oracle disponibili utilizzando il comando:
$ yay jdk
Il comando precedente visualizzerà tutte le versioni Oracle JDK e JRE disponibili. Basta digitare il numero di tua scelta. Installerò la versione più recente di Oracle Java, che è Versione 10.0.2 al momento della stesura di questa guida. Quindi, ho inserito il numero:24 .
1 extra/jdk10-openjdk 10.0.1.u10-1 (78.0 MiB 89.2 MiB) OpenJDK Java 10 development kit 2 extra/jdk7-openjdk 7.u171_2.6.13-1 (15.2 MiB 19.6 MiB) OpenJDK Java 7 development kit 3 extra/jdk8-openjdk 8.u172-2 (8.2 MiB 38.0 MiB) (Installed) OpenJDK Java 8 development kit 4 extra/jdk9-openjdk 9.0.4.u11-1 (78.0 MiB 89.8 MiB) OpenJDK Java 9 development kit 5 extra/jre10-openjdk 10.0.1.u10-1 (229.6 KiB 663.0 KiB) OpenJDK Java 10 full runtime environment 6 extra/jre10-openjdk-headless 10.0.1.u10-1 (34.3 MiB 170.5 MiB) OpenJDK Java 10 headless runtime environment 7 extra/jre7-openjdk 7.u171_2.6.13-1 (160.4 KiB 444.0 KiB) OpenJDK Java 7 full runtime environment 8 extra/jre7-openjdk-headless 7.u171_2.6.13-1 (42.6 MiB 78.3 MiB) OpenJDK Java 7 headless runtime environment 9 extra/jre8-openjdk 8.u172-2 (166.6 KiB 458.0 KiB) (Installed) OpenJDK Java 8 full runtime environment 10 extra/jre8-openjdk-headless 8.u172-2 (26.0 MiB 95.8 MiB) (Installed) OpenJDK Java 8 headless runtime environment 11 extra/jre9-openjdk 9.0.4.u11-1 (230.7 KiB 632.0 KiB) OpenJDK Java 9 full runtime environment 12 extra/jre9-openjdk-headless 9.0.4.u11-1 (34.1 MiB 170.7 MiB) OpenJDK Java 9 headless runtime environment 13 extra/openjdk10-doc 10.0.1.u10-1 (14.7 MiB 309.5 MiB) OpenJDK Java 10 documentation 14 extra/openjdk10-src 10.0.1.u10-1 (55.1 MiB 62.5 MiB) OpenJDK Java 10 sources 15 extra/openjdk7-doc 7.u171_2.6.13-1 (10.8 MiB 233.2 MiB) OpenJDK Java 7 documentation 16 extra/openjdk7-src 7.u171_2.6.13-1 (38.4 MiB 43.0 MiB) OpenJDK Java 7 sources 17 extra/openjdk8-doc 8.u172-2 (12.0 MiB 271.8 MiB) OpenJDK Java 8 documentation 18 extra/openjdk8-src 8.u172-2 (21.0 MiB 22.8 MiB) OpenJDK Java 8 sources 19 extra/openjdk9-doc 9.0.4.u11-1 (14.7 MiB 316.8 MiB) OpenJDK Java 9 documentation 20 extra/openjdk9-src 9.0.4.u11-1 (55.2 MiB 63.5 MiB) OpenJDK Java 9 sources 21 extra/visualvm 1.3.9-1 (7.9 MiB 32.4 MiB) Visual tool integrating several commandline JDK tools and lightweight profiling capabilities 22 community/java-atk-wrapper-openjdk7 0.33.3-1 (3.6 KiB 1.0 KiB) ATK wrapper for screen reader access to Java Swing applications - OpenJDK 7 23 community/java-atk-wrapper-openjdk8 0.33.3-1 (3.5 KiB 1.0 KiB) ATK wrapper for screen reader access to Java Swing applications - OpenJDK 8 24 aur/jdk 10.0.2-1 (+787 5.21%) Oracle Java Development Kit 25 aur/jdk7 7u80-1 (+136 0.15%) Oracle Java 7 Development Kit (public release - end of support) 26 aur/jdk6 6u45-6 (+85 0.93%) Oracle Java 6 Development Kit (public release - end of support) 27 aur/jdk-docs 10.0.2-1 (+57 0.41%) Documentation for Oracle Java Development Kit 28 aur/jdk8 8u181-1 (+55 4.18%) Oracle Java 8 Development Kit 29 aur/jdk-devel 11b24-1 (+40 0.95%) Oracle Java 11 Development Kit Snapshot 30 aur/jre8-openjdk-headless-infinality 8.u172-3 (+33 0.31%) (Orphaned) OpenJDK Java 8 headless runtime environment with infinality patch applied 31 aur/jre8-openjdk-infinality 8.u172-3 (+33 0.31%) (Orphaned) OpenJDK Java 8 full runtime environment with infinality patch applied 32 aur/jdk8-openjdk-infinality 8.u172-3 (+33 0.31%) (Orphaned) OpenJDK Java 8 development kit with infinality patch applied 33 aur/jdk7-openjdk-infinality 7.u171_2.6.13-1 (+27 0.10%) OpenJDK Java 7 development kit 34 aur/jre7-openjdk-infinality 7.u171_2.6.13-1 (+27 0.10%) OpenJDK Java 7 full runtime environment 35 aur/jre7-openjdk-headless-infinality 7.u171_2.6.13-1 (+27 0.10%) OpenJDK Java 7 headless runtime environment 36 aur/intellij-idea-ce 2018.2-1 (+25 1.08%) Intellij Idea IDE (community version) with Intellij JDK 37 aur/intellij-jdk 8u152b1293.1-1 (+21 0.12%) OpenJDK Java 8 development kit with some fixes and enhancements by JetBrains 38 aur/bin32-jdk 8u181-1 (+17 0.11%) Oracle Java 8 Development Kit (32-bit) 39 aur/jdk-arm 8u181-1 (+13 0.64%) Oracle Java Development Kit (v8) for ARMv7, ARMv6 and ARMv8 (64-bit) 40 aur/jre8-openjdk-jetbrains-headless 8.u152.b1119.3-1 (+10 0.43%) OpenJDK Java 8 headless runtime environment (with JetBrains patches) 41 aur/jre8-openjdk-jetbrains 8.u152.b1119.3-1 (+10 0.43%) OpenJDK Java 8 full runtime environment (with JetBrains patches) 42 aur/openjdk8-jetbrains-doc 8.u152.b1119.3-1 (+10 0.43%) OpenJDK Java 8 documentation (with JetBrains patches) 43 aur/jdk8-openjdk-jetbrains 8.u152.b1119.3-1 (+10 0.43%) OpenJDK Java 8 development kit (with JetBrains patches) 44 aur/openjdk8-jetbrains-src 8.u152.b1119.3-1 (+10 0.43%) OpenJDK Java 8 sources (with JetBrains patches) 45 aur/jdk-demos 8u181-1 (+7 0.00%) Demos and samples of common tasks and new functionality in Oracle Java 8 Development Kit 46 aur/bin32-jdk7 7u80-1 (+7 0.00%) Oracle Java 7 Development Kit (32-bit) (public release - end of support) 47 aur/jdk8-docs 8u181-1 (+7 0.30%) Documentation for Oracle Java 8 Development Kit 48 aur/jdk-devel-docs 11b24-1 (+7 0.02%) Documentation for Oracle Java 11 Development Kit Snapshot 49 aur/jdk9 9.0.4-1 (+6 0.54%) Oracle Java 9 Development Kit (public release - end of support) 50 aur/jdk9-openj9-bin 9.181-2 (+6 0.04%) (Out-of-date 2018-06-30) Eclipse (former IBM) OpenJ9 with openjdk9 51 aur/tuxjdk-doc 8.152.03-2 (+5 0.00%) OpenJDK Java 8 documentation 52 aur/tuxjdk 8.152.03-2 (+5 0.00%) Enhanced Open Java Development Kit for developers on Linux. Contains series of patched to OpenJDK to enhance user experience with Java-based and Swing-based tools (NetBeans, Idea, Android Studio, etc) 53 aur/tuxjdk-src 8.152.03-2 (+5 0.00%) OpenJDK Java 8 sources 54 aur/jdk8-j9-bin 8.0.5.7-1 (+4 0.02%) IBM® SDK, Java Technology Edition, Version 8 55 aur/jdk8-openj9-bin 8u162-b12-1 (+4 0.08%) Eclipse (former IBM) OpenJ9 with openjdk8 56 aur/bin32-jdk6 6u45-5 (+3 0.00%) Oracle Java 6 Development Kit (32-bit) (public release - end of support) 57 aur/jdk5 5u22-1 (+3 0.00%) Oracle Java 5 Development Kit (public release - end of support) 58 aur/ldapjdk 4.19-1 (+2 0.00%) The Mozilla LDAP Java SDK 59 aur/bin32-jdk5 5u22-1 (+2 0.00%) Oracle Java 5 Development Kit (32-bit) (public release - end of support) 60 aur/zulu-jdk 8u144b01-1 (+2 0.01%) (Out-of-date 2017-11-13) Zulu JVM built upon OpenJDK 8 61 aur/jdk7r1-j9-bin 7.1.4.15-1 (+1 0.02%) IBM® SDK, Java Technology Edition, Version 7 Release 1 62 aur/jdk-dcevm 8u144-1 (+1 0.00%) Oracle Java Development Kit with DCEVM patches 63 aur/java8-openjdk-hsdis 8.u112-1 (+1 0.00%) (Out-of-date 2018-05-14) Disassembler for HotSpot 64 aur/jdk7-j9-bin 7.0.10.15-1 (+1 0.02%) IBM® SDK, Java Technology Edition, Version 7 65 aur/jre8-openjdk-shenandoah 8.u172_20180725_hotspot90ead13709c0-1 (+0 0.00%) OpenJDK Java 8 full runtime environment 66 aur/jre8-openjdk-shenandoah-headless 8.u172_20180725_hotspot90ead13709c0-1 (+0 0.00%) OpenJDK Java 8 headless runtime environment 67 aur/jdk8-openjdk-shenandoah 8.u172_20180725_hotspot90ead13709c0-1 (+0 0.00%) OpenJDK Java 8 development kit 68 aur/openjdk8-shenandoah-src 8.u172_20180725_hotspot90ead13709c0-1 (+0 0.00%) OpenJDK Java 8 sources 69 aur/openjdk8-shenandoah-doc 8.u172_20180725_hotspot90ead13709c0-1 (+0 0.00%) OpenJDK Java 8 documentation 70 aur/jtreg 4.2+b12+7b1496d2790e-1 (+0 0.00%) Regression Test Harness for the JDK 71 aur/jtreg-hg r429+.7b1496d2790e+-1 (+0 0.00%) Regression Test Harness for the JDK 72 aur/java-8-openjdk-shenandoah b219-1 (+0 0.00%) (Orphaned) OpenJDK Java 8 development kit with ultra-low pause time Shenandoah GC ==> Packages to install (eg: 1 2 3, 1-3 or ^4) ==> 24
Durante l'installazione, ti verrà chiesto di inserire la password dell'utente sudo. Inserisci la password e attendi qualche istante per completare l'installazione.
Quindi controlla gli ambienti Java disponibili nel tuo sistema usando il comando:
$ archlinux-java status Available Java environments: java-10-jdk java-8-openjdk (default)
Come vedi nell'output sopra, ho due versioni Java (openjdk e oracle java) e l'ambiente predefinito è java-8-openjdk. Per impostare Oracle jdk come java predefinito, eseguire il comando seguente:
$ sudo archlinux-java set java-10-jdk/jre
Se hai impostato un collegamento all'ambiente java non valido, usa il comando seguente per risolverlo.
$ sudo archlinux-java fix
Ecco fatto. Ora controlla la versione java usando il comando:
$ java -version
Output di esempio:
java version "10.0.2" 2018-07-17 Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13) Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)
Come puoi vedere nell'output sopra, è stata installata l'ultima versione stabile di Oracle Java.