How should I use Java 9 in circle?

Hello!

Elasticsearch recently began requiring their plugins support Java 9. So I upped oraclejdk8 → oraclejdk9 here but I’m getting the error

unknown java version

Is there a supported method of doing Java 9 + Gradle I should be using instead?

I’ve not used Elasticsearch, but some general advice: if you can get it working on your local Linux machine, you can get it working on Circle. I’d therefore treat this problem as a Elasticsearch problem, not a Circle problem.

I imagine your base image is Ubuntu, but you can use any base image you like. Can you build a Docker image locally containing the versions of things you need? Is it Gradle or Elasticsearch that outputs the error?

For the record, I needed to upgrade from circle yaml 1 -> 2, and point at a java 9 docker image. You can see here

Since there are no pre-created machines with jdk9 you have to build it out yourself. I removed the java part of the machine declaration and then added:

machine:
  environment:
      JAVA_HOME: /usr/lib/jvm/java-9-oracle
dependencies:
  pre:
    - sudo add-apt-repository -y ppa:webupd8team/java; sudo apt-get update
    - echo "oracle-java9-installer shared/accepted-oracle-license-v1-1 select true" | sudo debconf-set-selections
    - echo "oracle-java9-installer shared/accepted-oracle-license-v1-1 seen true" | sudo debconf-set-selections
    - sudo apt-get -y install oracle-java9-installer
    - sudo apt-get install oracle-java9-set-default
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.