I am using Ubuntu on a new laptop. I have downloaded java 11 and Gradle-6.6.1 per my instructors instructions. Java 8 has never been downloaded. When compiling the instructors example code, the compile fails for var types and a Network class. We believe Gradle is using java 8. I can not figure out how to get Gradle to use 11. Here are the instructions I followed for downloading both..
wget https://download.java.net/openjdk/jdk11/ri/openjdk-11+28_linux-x64_bin.tar.gz
Then unpack the tar file with: tar zxvf openjdk-11+28_linux-x64_bin.tar.gz
I moved the unpacked file into a different folder: sudo mv jdk-11 /opt/
And removed the tar rm openjdk-11+28_linux-x64_bin.tar.gz
Open vim to edit env variables: sudo vim /etc/profile.d/java.sh
Copy into the file and :wq export JAVA_HOME=/opt/jdk-11 export PATH=${JAVA_HOME}/bin:${PATH}
Next time you login to your console java -version javac -version GRADLE (info (Links to an external site.))
Or download and install:
To download gradle (example gradle 6.6.1 -- please check on this page for the version you should install):
wget https://services.gradle.org/distributions/gradle-6.6.1-bin.zip
To unzip: unzip gradle-6.6.1-bin.zip I moved the unpacked file into a different folder (could have also moved while extracting): sudo mv gradle-6.6.1 /opt/ And removed the zip rm gradle-6.6.1-bin.zip Open vim to edit env variables: sudo vim /etc/profile.d/gradle.sh Copy into the file and :wq export GRADLE_HOME=/opt/gradle-6.6.1 export PATH=${GRADLE_HOME}/bin:${PATH} Next time you login to your console
gradle --version