Firstly, I would like to apologize as I'm not quite sure whether this question is suitable to be on this site or Stackoverflow. I chose U&L eventually because the traffic here is much lower compared to SO, and it makes my question stay longer on the main page.
I'm currently on Elementary OS 0.3 Freya. After installing it, one of the first few things I did was getting the Java using the commands:
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java9-installer
However, at that point, I wasn't quite sure what kind of Java(JVM,JRE,JDK) I was actually installing due to unclear understanding regarding those terms. Everything was fine until I started to use Android Studio. The installation went smoothly but I was prompted an error on the start-up of the program itself. Having tried many ways but to no avail, I decided to reinstall my Java. This is the method I used to uninstall Java. To make sure that I've completely removed it, I run the command java --version
to check. The result showed that I got the Java uninstalled but what exactly that sparked my curiosity was that I could still run my Android Studio, which is written in Java. And so I searched up and read this to clear up my misconception and realize that I had installed JRE twice because the JDK, which includes JRE, was also downloaded before the installation of Android Studio took place.
So, here's my question:
When we execute the three lines I listed above to install Java, are we installing the JRE or the JDK?
Do we need to install JRE if we are also going to install JDK? (Since JDK includes JRE)
Is there any commands that can install JDK like those three lines?
Why can't the system detect the JRE in the JDK I downloaded from the official site when I run
java --version
?What is the difference(s) between the program that is installed using terminal and those who is downloaded from the web?
Sorry for putting five questions in a single thread. And for reading my laughable experience. You probably are laughing at my stupidity now, but I still hope you can help out to clear my doubts. Thanks in advance.