Sometimes you need JDK8 in your docker image …

… and depending the base image this may not be available, even from the ppa repositories. Moreover, you cannot download it directly from Oracle without a username / password anymore, so this may break automation, if you do not host your own repositories. Have no fear, sdkman can come to the rescue and fetch for you a supported JDK8 version. You need to pay some extra care with JAVA_HOME and PATH though:

FROM python:3.6-slim
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y curl zip unzip
RUN curl -fsSL https://get.sdkman.io -o get-sdkman.sh
RUN sh ./get-sdkman.sh
RUN bash -c "source /root/.sdkman/bin/sdkman-init.sh && sdk install java 8.0.212-amzn"
ENV JAVA_HOME=/root/.sdkman/candidates/java/current
ENV PATH=$JAVA_HOME/bin:$PATH
CMD bash

Since curl | sudo bash is a topic of contention, do your homework and decide whether you’re going to use it as displayed in the Dockerfile above, or employ some extra verification mechanism of your choice.

Device drivers in Java?

The following tweet by @DSpinellis:

#USENIX @AnnualTech M. Renzelmann Decaf: Moving Device Drivers to a Modern Language (Java). He says performance impact is 1%

talks about “Decaf: Moving Device Drivers to a Modern Language” which describes a system where large parts of a driver can be written in a better language than C, the example here being Java.

I was certain that this was not the first time I had read about such an idea. This weekend I was able to go through my archive and find out the reference. Back in January 1997 in the NT Insider (Volume 4, Issue 1) Peter Viscarola, while criticizing the multitude of startups founded by anyone who could code a Java applet (this was a pre-dot-boom era remember) wrote:

It’s obvious that we are missing a real opportunity here to capitalize on the convergence of these trends. We need to immediately fund a start-up company to develop a package for writing Windows NT drivers in Java. THINK of it! We could have processor architecture independent device drivers that don’t even need to be recompiled in order to support X86, PPC, and Alpha machines! Amazing! We could create a visual driver development environment, complete with cute animated assistants. And, the drivers could probably have a visual component to them, so you could actually see your toaster-oven driver doing its work. Cool! THEN we could all be challenged, and have fun, and get rich at the same time. Wow! Why didn’t I think of this before?

It would be nice if we could see Peter’s views on the subject 12 years later.

clickomania

Clickomania, ο απόλυτος χρονοφάγος. Για χρόνια έπαιζα μια εκδοχή του παιχνιδιού που έτρεχε σαν Java Applet κάπου στο Brown (εάν τη θυμάται κανείς, ας μου στείλει το (πεθαμένο) URL). Όμοια και η εκδοχή του που περιλαμβάνεται στο Axim X3 με έχει συντροφέψει σε πάμπολλες διαδρομές με το λεωφορείο. Ψάχνοντας μετά από καιρό το site του παιχνιδιού, είδα πως έχει και Ελληνική μετάφραση.

Μην το παίξετε. Έχετε προειδοποιηθεί.

The Gosling Tarpit

I think Panagiotis is going to love this:

“because the Java programming language and Java Virtual Machine are (surprise!) so tightlyCoupled, new language designers are compelled to make their languages such that they use only those features they can implement efficiently on the JVM. For example, implementations of Scheme for the JVM either lack call/cc or have a very slow and slightly buggy implementation of it. We call this the Gosling Tarpit.”

From Phosphorous, The Popular Lisp.

[via]

Η Java δεν είναι C…

– Στη Java πατάς την τελεία (.) και σου βγαίνουν οι επιλογές. Δεν είναι σαν τη C που πρέπει να τα γράφεις όλα με το χέρι.

Δεν κατακρίνω αυτόν που το είπε. Αυτοί που τον έμαθαν να σκέφτεται έτσι πρέπει να βρούν τρύπα να κρυφτούν.