How to enforce gradle to use specific jdk while building a project?

We use gradle to build our project and use circleci.yml to configure the build when building on circleci. We are using almost same configuration for most of the project while building with gradle on circleci. Recently noticing that it is building with lower version of jdk while we need to use jdk 11. In our case , Circleci is spinning up containers to run the build.
Is there a way to instruct gradle to use jdk11 specifically?( not the jdk path but specific image)

Here is a glimpse of circleci.yml:

version: 2
jobs:
  build:
    docker:
      - image: circleci/openjdk:11.0.3-jdk-stretch

    working_directory: ~/repo

    environment:
      JVM_OPTS: -Xmx512m

    steps:
      - checkout

      - run: echo $(cd ~/repo && git rev-parse HEAD && cd -) > git-commithash
      - persist_to_workspace:
          root: .
          paths: git-commithash

      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "build.gradle" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      - run:
          name: Run tests and build executable
          command: cat /dev/null | ./gradlew build

      - save_cache:
          paths:
            - ~/.gradle
          key: v1-dependencies-{{ checksum "build.gradle" }}

      - setup_remote_docker:
          docker_layer_caching: true

      - run:
          name: Push k8s application Docker image
          command: |
            docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
            docker build -t rudako/k8s-$CIRCLE_PROJECT_REPONAME -f k8s/Dockerfile .
            docker tag rudako/k8s-$CIRCLE_PROJECT_REPONAME rudako/k8s-$CIRCLE_PROJECT_REPONAME:$CIRCLE_SHA1
            docker push rudako/k8s-$CIRCLE_PROJECT_REPONAME

  deploy-to-dev:
    docker:
      - image: rudako/kubedeploy
        auth:
          username: $DOCKER_USER
          password: $DOCKER_PASSWORD

    steps:
      - checkout

      - attach_workspace:
          at: .

      - run:
          name: Current git commit hash
          command: cat git-commithash

      - run:
          name: Set ENV and CERT_ARN env variables
          command: |
            echo "export GIT_HASH=$(cat git-commithash | awk '{print $1}')" > $BASH_ENV
            echo 'export ENV="dev"' >> $BASH_ENV
            echo 'export DOMAIN="$DEV_DOMAIN"' >> $BASH_ENV
            echo 'export REPLICAS=1' >> $BASH_ENV

      - run:
          name: Switch kubectl context
          command: kubectl config use-context dev-eks

      - run:
          name: Cluster Info
          command: kubectl cluster-info

      - run:
          name: deploy to DEV
          command: |
            source $BASH_ENV
            envsubst < k8s/deploy.yml | kubectl apply -f -

Source: StackOverflow