Java 9 no longer needs add-apt-repository

When I ran Ansible a little while ago, I couldn't install Java 9 on Ubuntu, so I wrote down what I checked.

Installation method so far

For commands.


$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java9-installer

ansible.yml


- name: add repository for install jdk9
  apt_repository:
    repo: 'ppa:webupd8team/java'
- name: auto accept license for java9
  shell: echo oracle-java9-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
- name: install jdk9
  apt:
    update_cache: yes
    name: oracle-java9-installer
    state: latest

These codes aren't breathing right now.

How to install from now on

For commands.


$ sudo apt-get install openjdk-9 #It fails once here, but DL the deb file
$ sudo apt-get install openjdk-9-jdk-headless
$ sudo dpkg --configure -a
$ sudo dpkg -i --force-overwrite '/var/cache/apt/archives/openjdk-9-jdk_9~b114-0ubuntu1_amd64.deb'
$ java -version
openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)

ansible.yml


- name: install jdk9
  apt:
    update_cache: yes
    name: "{{ item }}"
    state: latest
  failed_when: False
  with_items:
    - openjdk-9-jdk

- name: install jdk9 headless
  apt:
    update_cache: yes
    name: "{{ item }}"
    state: latest
  with_items:
    - openjdk-9-jdk-headless

- name: dpkg java9
  shell: |
    dpkg --configure -a
    sudo dpkg -i --force-overwrite '/var/cache/apt/archives/openjdk-9-jdk_9~b114-0ubuntu1_amd64.deb'

As you may have noticed, the above is just the installation method for the time being. I think these command codes will take your breath away when the time comes. But at that time, I think the world will be easier, how to install it.

Click here for more details https://askubuntu.com/questions/769467/can-not-install-openjdk-9-jdk-because-it-tries-to-overwrite-file-aready-includ

Recommended Posts

Java 9 no longer needs add-apt-repository
[Java] Problem No. 2
[Java] Problem No.1
If variables are no longer highlighted in Eclipse's Java editor
Beginner's word No4 (Java command, JVM)
Run-app with grails no longer boots