When you run:
$sudo apt install eclipse
You are downloading Eclipse from the software package repositories of your operating system ( which I presume is Ubuntu or similar).
The version of Eclipse in the software repositories of Ubuntu/Debian is not updated much and tends to be very old compared to the version of eclipse available on eclipse.org.
Take a look at the version of eclipse in Debian and Ubuntu's package repositories:
You can see that the version is 3.8 which is Eclipse
Juno while the latest is
When you are installing Eclipse from the website of eclipse.org you are running the latest package offered by eclipse.org which is Photon.
So the clear difference being the versions of Eclipse. Software repository of Ubuntu is providing an older version, while the website provides the latest version.
The difference between 3.8 (Juno) and 4.8 (Photon) is about 6 releases, and between six releases of lot things change.
You are getting the
java.lang.ClassNotFoundException: error, because of a lot of code base has deviated between the six releases. Also the code base of JRE/JDK has changed as well. I will not try to look into what has changed because six releases are a lot.
You better uninstall any Eclipse versions from the repositories and only use the one from the website.