Help us understand the problem. What is going on with this article?

もうJava9にadd-apt-repositoryは要らない

More than 1 year has passed since last update.

ちょっと昔のAnsibleを動かしたらUbuntuでJava9がインストできなくなっていたので、調べたことを書き留めます。

これまでのインストール方法

コマンドの場合.
$ 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

このコードたちは今は息をしていません。

これからのインストール方法

コマンドの場合.
$ sudo apt-get install openjdk-9 #ここで一度失敗するがdebファイルをDLする
$ 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'

お気づきの方しかいないと思いますが、上記はあくまで当面のインストール方法です。時が来たらこのコマンド・コードたちは息を引き取ると思います。
でもその時にはもっと楽な世界になっていると思います、インストール方法が。

もっと詳しいことはこちら https://askubuntu.com/questions/769467/can-not-install-openjdk-9-jdk-because-it-tries-to-overwrite-file-aready-includ

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした