Thursday, July 12, 2018

How to install or update your preferred JDK with one single command on macOS or GNU/Linux?

What is your preferred JRE/JDK? Is it the Oracle JDK from oracle.com or the JRE from java.com, the OpenJDK from jdk.java.net or the OpenJDK from adoptopenjdk.net or zulu.org? Whatever your preference is, you can install or update the JDK with only one single command on macOS or GNU/Linux with the bash script called update_jdk.

You can download it from here for free:
https://github.com/jonelo/bashberries/blob/master/bin/update_jdk

And here comes the one-liner:

sudo ./update_jdk -az -s adoptopenjdk.net -t openjdk10 /opt/java/jdk/
The command above downloads the OpenJDK 10 from adoptopenjdk.net (you can specify the source and type with -s and -t), extracts it, applies the latest time zone data from IANA by downloading, extracting and calling the latest time zone updater (you have to accept the Oracle license by specifying the -a option) and it saves .version files that store the URI of the actual download for re-run purposes (see below). In /opt/java/jdk/ you will then find symlinks that point to the latest latest updated OpenJDK 10 folder (and the latest tzupdater.jar if you run the script with -z). Now you have a fixed path that you can use to configure your IDE, apps, whatever.
$ /opt/java/jdk/openjdk10_latest/bin/java -version
openjdk version "10.0.1-adoptopenjdk" 2018-04-17
OpenJDK Runtime Environment (build 10.0.1-adoptopenjdk+10)
OpenJDK 64-Bit Server VM (build 10.0.1-adoptopenjdk+10, mixed mode)
If you re-run the script above, it will only download the bits if they are different from those that you have downloaded already (it simply compares the .version file), updates the JDK that you have specified with -t and recreates the symlinks. So with the update_jdk script you stay up to date the easy way.


Update Aug 24, 2018:
bash-dwarfs has been renamed to bashberries

Update Sep 23, 2018:
update_jre has been renamed to update_jdk
 

Sunday, June 17, 2018

NumericalChameleon is running in the web browser using Webswing

Today I run the NumericalChameleon (a Swing based app) in my web browser on my desktop by using Webswing. It really works like a charm! The NC GUI acts in just the same way as it does when running natively.

It works like a charm - in the web browser on the desktop

I downloaded and installed Webswing 2.5.4. and I did no modifications on the NumericalChameleon 2.1.0. I just copied the NC folder to the Webswing demo folder and entered some values at the configuration dialog such as Name, Icon, Home Folder, Working Directory, Class Path, etc. After I have configured it in Webswing, the app appears in the app list of Webswing:





The NC GUI acts in just the same way as it does when running natively on bare metal.

Even theme selection, language selection, restarting the app, updating exchange rates and audio was working (at least when the process is running on localhost)! The performance is surprisingly good, although a little bit slower if I compare it with native performance.

One (minor) problem I found was that opening help and opening data tables didn't work, because the help files and data tables are stored locally as HTML. In the log I found traces of "WebPaintDispatcher:notifyOpenLinkAction", so the action was recognized, but no action happened.

Normal http links were working, however.

It didn't work well on the smart phone, though

I also tried to access the above setup on my smart phone, but without having a screen keyboard, the usage of a Swing app in the browser is very limited, especially if I rely on entering numbers to a software. Also it seems not to be possible to move windows around inside the browser. At least it was pretty funny to hear the numbers spoken by NC on my desktop audio boxes when I pushed the play sound button on my smartphone ;-)


Summary

In the web browser on the desktop using Webswing, the Swing based app NumericalChameleon is working pretty well actually. It is worth to try it!


Sunday, March 11, 2018

... and all I got was this lousy T-shirt

To be honest, it is not a lousy T-shirt at all, it is great T-shirt from the Linux Foundation actually. It has a simplified Tux icon and a little riddle on its front:



Warning: don't scroll down if you want to solve the riddle by your own. Scroll down in order to see how I solved the riddle.
.
.
.
.
.
.
.
.
.
.
   2nd WARNING
   DON'T SCROLL DOWN IF YOU WANT TO SOLVE IT BY YOUR OWN !!!
.
.
.
.
.
.
.
.
.
.
   Last WARNING
   Ok, either you have solved the riddly by your own or you are simply too curious ;-)
   OK, FEEL FREE TO SCROLL DOWN IF YOU WANT TO SEE THE SOLUTION !!!
.
.
.
.
.
.
.
.
.
Actually, I was wondering whether I can solve the riddle by using the NumericalChameleon (yeah, you know I am the author of it, don't you?) and I am glad to announce that it can be used to solve the riddle as well. I entered the bitstream at the category "Positional Notations, Radix 2-36", and converted the value to hex. Since the Unicode character set is a superset of ASCII, and numbers 0 - 127 have the same meaning in ASCII as they have in the Unicode character set, it was possible to prefix each hex number by 00 in order to satisfy the expected input format at the "Unicode® Characters (Basic Multilingual Plane)" category. Below you see screenshots of both the NumericalChameleon (with the solution) and a hex editor in the background (with the solution) in order to verify the result.