Wednesday, June 24, 2015

Desktop Market Share - 2015

I have just found out this interesting statistics about desktop computers. And it tells me some more interesting possibilities:

- Apple Operating System is by far better than Windows in everything, everybody know this. But according to these statistics, it is the 5th most popular OS. Well, it is not that easy to work a "hackintosh", and Apple OS is originally installed on Apple computers ONLY, wich are MUCH more expensive than PCs, like this old I5 of mine.

- Windows XP is still under that heavy use? SERIOUSLY? Unless you pay MS for it, you will not have the security updates that you really need. And most people will definitively not pay for this. But, they are still using XP for activities like ... their bank account. This is insane, almost a financial suicide. But, I think that the word "security" is still not clear enough to people in general. Until something bad really happens.

- Okay, Linux definitively is not ready for desktops, although I've been using it for almost 10 years, and I DO CONSIDER it as the most affordable and safe option. But anyway, Linux market share has overcame the old Apple OS versions. No, it is not superior to these recently old Apple OS versions (not yet, and it will take a long time to happen). Apple users update their OS more frequently than Linux and Windows users, and older versions become less used very quickly. That's why Linux has "beaten" them.

This universe of desktops, will always be so difficult to be understood...

The full statistic link can be read here.

Saturday, June 20, 2015

Installing Java 8 in Ubuntu

I have another post here about how to do this. But it is outdated, and I decided to rewrite it.

There are more simple ways to have Java installed on your Linux. But I do prefer do make it step by step, in the command line. Let's suppose that we are installing version 8.45 of Java
  1. Download Java 8 JDK from Oracle. Accept it's License Agreement, and select jdk-8u45-linux-x64.tar.gz to be downloaded, if your system is 64bits or jdk-8u45-linux-i586.tar.gz if it is 32 bits.
    If you are in doubt about your system, you may confirm with the following command:

    uname -m

    If the answer is x86_64, you have a 64 bits Ubuntu. If the answer is  i686, you have a 32 bits Ubuntu.
  2. Create a variable jv that will point to the installation directory of Java. By downloading the jdk-8u45-linux-x64.tar.gz, we will have /usr/lib/jdk1.8.0_45 as the installation directory.
    We need to create another variable ub, that will point to the the system binaries.
    We do that with the following command:

    Not only copy and paste above lines.
    Update Java version in variable jv.
  3. I usually do not use the previous versions, so I do remove them Since I always install them in /usr/lib, I will remove them with the following command:
    sudo rm -rfv /usr/lib/jdk* /usr/lib/jvm/jdk*

    It is important to repeat to the novice: The command above wil permanently delete the contents of
     /usr/lib/ e /usr/lib/jvm/ that start with jdk. Be sure you do not have in there any other files or directories that may be deleted.
    In case you are not sure whether you may delete this files or not, just do not do it.
  4. Open the file you have downloaded from Oracle in /usr/lib/:

    sudo tar xf jdk-8u45-linux-x64.tar.gz -C /usr/lib/
  5. Update alternatives system with the binaries of this version of Java:

    sudo update-alternatives --install ${ub}/java java ${jv}/bin/java 1
    sudo update-alternatives --install ${ub}/jcontrol jcontrol ${jv}/bin/jcontrol 1
    sudo update-alternatives --install ${ub}/javac javac ${jv}/bin/javac 1
    sudo update-alternatives --install ${ub}/javaws javaws ${jv}/bin/javaws 1
    sudo update-alternatives --install ${ub}/keytool keytool ${jv}/jre/bin/keytool 1
    sudo update-alternatives --install ${ub}/pack200 pack200 ${jv}/jre/bin/pack200 1
    sudo update-alternatives --install ${ub}/rmid rmid ${jv}/jre/bin/rmid 1
    sudo update-alternatives --install ${ub}/rmiregistry rmiregistry ${jv}/jre/bin/rmiregistry 1
    sudo update-alternatives --install ${ub}/unpack200 unpack200 ${jv}/jre/bin/unpack200 1
    sudo update-alternatives --install ${ub}/servertool servertool ${jv}/jre/bin/servertool 1
    sudo update-alternatives --install ${ub}/tnameserv tnameserv ${jv}/jre/bin/tnameserv 1
    sudo update-alternatives --install ${ub}/jexec jexec ${jv}/jre/lib/jexec 1

    The following command only applies to 32 bits desktop systems:

    sudo update-alternatives --install /usr/lib/mozilla/plugins/ ${jv}/jre/lib/i386/ 1

    The following command only applies to 64 bits desktop systems:

    sudo update-alternatives --install /usr/lib/mozilla/plugins/ ${jv}/jre/lib/amd64/ 1
  6. In case of having more than one Java version installed, only one will be the default version. The following command will perform this action:

    for i in keytool jcontrol pack200 rmid rmiregistry unpack200 servertool tnameserv jexec java javac javaws; do sudo update-alternatives --config ${i}; echo; done

    The above instruction will list all available versions of each binary, if they exist. Choose those listed in step 2. If not, you will obviously have nothing to choose.
After that, we should test the installation to confirm that it is all ok:
java -version
javac -version
Now, we need to set the environment variables correctly. I adapted it from WikiHow. You must edit /etc/profile, adding the following lines by the end of it:
# Environment Java Variables defined IF Java is listed in "alternatives"
if [ -h /etc/alternatives/java ]; then
     a=$(/bin/ls -l /etc/alternatives/java | cut -d \> -f2|cut -d' ' -f2)
     export JAVA_HOME=${a%/bin/java}
     export PATH=${PATH}:${JAVA_HOME}/bin
After editing /etc/profile, we need to close this user section and open it again. Finally, to check it use the following commands:
You will have /usr/lib/jdk1.8.0_45 as answer, according to the version you installed.
echo $PATH
Will give you the whole PATH, and by the end the Java directory. On mine the answer was /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jdk1.8.0_45/bin

Most of this article was written after studying Ubuntu Documentation and resolving some problems on Tomcat7 instalation at a Ubuntu Server.

If you liked it, please write a comment or click on "+1" button.

And, we are back ...

After a long time with no addings, I will restart this as my notebook. I hope it helps many with their Linux struggles.