Tuesday, 14 January 2014

Installing JDK in Fedora Core

Seems to work fine. I am writing it down here, because I do not do it often, and I keep forgetting the steps.

Installing java


I have switched over to using openjdk. It seems to be pretty stable and standard in Fedora Core.

The openjdk-7-jre package contains just the Java Runtime Environment
yum install java-1.7.0-openjdk
The actual Java Development Kit can be installed as below.
yum install java-1.8.0-openjdk-devel
Call me weird, but I find it confusing to name both packages "openjdk", but then, that's the name of the thing.

Switching javac

If I try "alternatives --config javac", I get.


There are 2 programs which provide 'javac'.

  Selection    Command
-----------------------------------------------
*  1           /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75-2.5.4.2.fc20.x86_64/bin/javac
 + 2           /usr/lib/jvm/java-1.8.0-openjdk.x86_64/bin/javac

Enter to keep the current selection[+], or type selection number: 

Switching java


If I try "alternatives --config java", I get.


There is 1 program that provides 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java

Enter to keep the current selection[+], or type selection number: 

I need to install the Oracle JDK, that is as simple as downloading the rpm and installing it with "rpm i jdk-7u13-linux-x64.rpm".

Then, I am required to set a symbolic link using the 'alternatives --install' commandline. See [1] for more information on that.

Then, I can set the default using "alternatives --config java" again.

[root@localhost Downloads]#  alternatives --config java

There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
   1           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
   2           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
*+ 3           /usr/java/jre1.7.0_45/bin/java

Enter to keep the current selection[+], or type selection number: 
Updated 22 April 2014: added OpenJDK, removed specifics regarding Oracle

References

[1] Installing Sun Oracle Java JDK on Fedora, Centos, Redhat and RHel
http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/
Java - FedoraProject
http://fedoraproject.org/wiki/Java
OpenJDK
http://openjdk.java.net/install/


Tuesday, 7 January 2014

Model-View-Controller

I have always had a problem understanding the Model-View-Controller pattern. Perhaps because I always thought the Controller should be in between the Model and the View. In reality, there are flows between all the different components.

Date and Time


One of the things that in my mind would be a perfect example is Date and Time. The reason that I think it is an excellent example, is the way the Model part is exceedingly simple, and the View part is exceedingly complex. The Model part is nothing more or less than a Long indicating the number of milliseconds since Jan 1, 1970 GMT. The View part is split up into years, months, days, hours, minutes, seconds, milliseconds, timezone, daylight savings time, leap years, and God knows what else. While the Model part is simple and convenient for a computer, the View part is complex, but required if you want your date/time to be meaningful to your users.


References


Wikipedia: Model-View-Controller
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller