Sunday, April 23, 2017

Setting multiple Java JRE/ JDK on MacOSX using brew, cask and jenv

Yesterday at the Java9, Jigsaw HackTheTower event, I realized that I need to step up my game and improve my existing mechanism on maintaining several different JDK's on my machines.

I used to manually download the jdk's, or install them using brew cask, and I would set 'bash alias' on my `~/bash_profile` to switch between different 'JAVA_HOME' etc etc.

I am already using brew & brew cask (official site here) & i recently started using 'CakeBrew'. So in order to install 3 different versions of java all you need to do is :

Step 1: Install JDK's using brew and  brew cask

> brew cask install caskroom/versions/java6
> brew cask install caskroom/versions/java7  
> brew install java

After the installation check the following folder, you are expected to see the 3 different JDK folders.

> cd /Library/Java/JavaVirtualMachines

 

Step 2: Install jenv

> brew install jenv 

Step 3: Add the 3 available JDK's to jenv

> jenv add /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
> jenv add /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
> jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home

Step 4: Check if jenv has registered the different jdk's

> jenv versions

Step 5: Use jenv to set up the JDK env either globally or the current shell

--Setting java 1.8 for the shell
> jenv shell 1.8
> java -version 
> jenv shell 1.7
> java -version 
-- this sets it globally
> jenv global 1.8
> java -version


All done! You can switch different versions easily!

Watch out for now

  • You can install a pre-release of java9 using ' brew cask install caskroom/versions/java9-beta' but it seems that the way it is installed and the paths are not compatible with what jenv expects so you can not jenv add 1.9 (for the time being)

Saturday, April 22, 2017

Java 9 Module System (Jigsaw) @ LJC's HackTheTower



Today we spent half a day, on our first HackTheTower event. Members of London's Java User Group (aka LJC),  gathered on the 26th floor of  'SalesForceTower'  (aka Heron Tower) at the City of London, invited by
to talk and learn about one Project Jigsaw, Java 9's modular-isation system. The event was well organized, and coding from above, viewing London's town center and the rest of the skyscrapers is really a thing!

The event was splint into 3 sections, where we were given exercises and material to cover around Jigsaw (small examples, similar to the one you will find on OpenJDK's pages) and then we could talk about or raise any concerns or missing things that we felt the should be fed back to the OpenJDK / Oracle devs, evolving Jigsaw.

You can find all the material / slides & our feedback on the following links:

 How do I feel about Jigsaw

I have to be honest, it seems that Jigsaw is my least favorite feature of Java 9. It was one of the reasons I joined the event. Not because it is a bad feature as such or the actual needs behind it, especially the one to make the core of the JDK/JRE modular or more IoT friendly. But because of the potential side effects on the existing Java ecosystem and applications. It is really the first time that I eventually I did not trial personal or work related projects with pre-releases, to see if they work with the new version of Java, because of the various problems (and I still have).

Were we missing Jigsaw like functionality? Yes. Did we have similar attempts? Yes we had, OSGi (was covering many parts), then years after JBoss Modules. I always found OSGi a nice idea, but too complicated . I had the chance to work with JBoss Modules, I liked it but this was only on a product that was built on top of it, the Wildfly Application server, so it was like a full-filled prophecy, so I never tried to applied on my project or any of the projects I worked for.

Today I was kind of frustrated seeing examples of Java code, accompanied with  bash scripts calling jdk specific command like tools. Javac with flags, jlink or jmod, Jars that are not jars, but they behave like jars. I felt like my first Java day's at the uni, where eventually Ant was still NOT a thing, and java was compiled with bespoke make file mechanisms etc. Do I like all this new tooling? No. Why? Because as an application/ business developer I rely on abstracted build tools and I expect they do the heavy lifting for me, i dont want to go back editing module- descriptors or fighting existing build tools where the Plain Old Jar is the king, with the new king the Module and vice versa.

So, currently I don't see a clear path for existing, mainstream Java Built tools. Yes work is underway, for example the Maven Compiler Plugin version 3.6.1 is Jigsaw compatible. By the way it seems that currently you need to map and package your JigSaw modules as Maven Modules, so that you can have the best of 2 world. I don't know this whole thing confuses me a bit, unless I miss something.

It seems that we are heading towards a Java ecosystem, at least for Java 9, where either you play with Jigsaw's rules and you start building something new from scratch, introducing modules & project structure compatible with Jigsaw semantics or you kind of close your eyes,  add the 'kill switch' or your java executions  and continue your quest towards the new and the old world.

Last but not least, I can not ignore, the increasing number of worries and posts from application server, library developers on the potential problems Java9 might introduce to their libraries. I guess all java application developers would like to use Java 9, but if it is like going to introduce 1000 new issues because Spring Class-loading is not working any more, or CDI or any sub-module of their application server is going to break this is kind of unnecessary noise. 

So for the time being I am skeptic about it, but I will continue to invest time and learn more or experiment with it, most probably not using my SpringBoot or WildflySwarm projects but rather simple. 

I really liked the following articles
  • https://blog.plan99.net/is-jigsaw-good-or-is-it-wack-ec634d36dd6f 
  • https://developer.jboss.org/blogs/scott.stark

Thursday, April 20, 2017

A small docker image with kubectl,helm, envsubst based on Alpine

I guess lots of people will have something similar, I thought to share my small customized container.

So here, you can find a small Alpine Based container, stuffed with
  1. bash
  2. curl
  3. envsubst
  4. kubectl
  5. helm (client)
It is mostly used as a `gitlab` runner, in order to `talk` to kubernetes clusters (injected with the appropriate kube-configs).

You can just run /pull it  like

docker pull javapapo/kube-runner:2
docker run -it javapapo/kube-runner:2

 Using different tags e.g 1, 2 etc, I just upgrade some of the versions of the above utils.

Currently I feature tag `1` and `2`.

No rocket science, maybe some people will find it usefull on their GitLab/Circle/BitBucket runner use cases.

ps) github repo is here

Monday, April 10, 2017

Awesome list of MacOSX utils

At some point, I used to have a similar list. For a couple of years, I used to come back to that post and update it. I think this one, is far better and much more flexible! In my spare time today, I started going through the sections and trying out stuff! It is kind of relaxing lol!

Already installed CakeBrew (i love brew/cask), trying out 'Tower' I think I am going to buy it, or giving 'Black Screen' a chance.

Give this guy a 'Github' star!

ps) I need to do a come back on my beloved blog - as a friend suggested yesterday.

Sunday, January 15, 2017

Upgrading my bash on MacOSX and simple tips found on the internet.

I find my self doing lots of work in the terminal lately, I have to admit I was not that type of guy or an expert, but over the years I needed to step my bash/cmd/terminal game up. 

So I just red yesterday this very short and simple article, and I was like , wait a minute I've done some of these mistakes in the past.  Master Bash and Terminal. Worth your time. I guess any bash / linux wizards already knows all of these simple trics. It was funny because in the examples the author claims that he searches a lot his bash history for previous executions of 'kubectl', I was like, Yes i do this a lot every day.

After reading this article I ended up to this simple guide on how to upgrade your default 'bash' version on MacOSX, from version 3.2.x to 4.4.x .

$ brew install bash
$ chsh -s /usr/local/bin/bash
And then make sure on iTerm to add this, so that it starts as a login terminal. (/usr/local/bin/bash --login)


ps) I have tried to switch to 'fish' some time ago, but still some incompatibilies and extra tricks you need to do, in order to have the very same experience with bash - i was not ready for this.

Saturday, December 03, 2016

Moving to the cloud & tech debt - a trap


I am thinking (or maybe I can see), that while more companies jump  to the cloud, migrating their existing software solutions and services, things like 'tech-debt' or 'architectural-debt' are going to become a first class citizen and hot topic, again. Which is a good thing! Really!!!

I am very happy about it, because I do believe that tech debt, over-engineered solutions or hype driven development do actually contribute to an increase rate of  'mediocre' software solutions and services, while we (the software engineers) think that we are doing just great.

But how tech debt is going to be again, a hot topic among meetings while migrating to the cloud? It is simple, the bill by the end of the month! Are you doing micro-services for no reason at all? Do you have a small monolith broken down to 1000 different pieces because this is the trend- for no good reason? Is your API chatty? Have you bundled a ton of libraries and features to your product that actually are not needed but it was just to play around with tech or your engineers to feel happy? Is your code spinning the CPU for no good reason? Is your code using the filesystem inefficiently? 

Maybe you had a 'hint' of these problems, but there were not so intense when you had full control or ownership of the deployment platform.

But now you don't control the hardware, you are being billed by individual operations.You PAY!
And at a certain point people will start to think about it again. Why our Google Cloud bill or AWS bill is so big? Maybe some will decide to go back. Who knows?

What I do suggest though is, spend some time and review your solution, your architecture and the quality of your code. There are for sure, great advantages offloading your infrastructure concerns to a more flexible - elastic world, but it is still YOUR software. And all the sins and mistakes of your software are not going to be 'hidden' or auto-magically resolved because you moved to the cloud, there is a high chance they are going to get' bigger'.


The cloud is great, but it wont make bad software great.

Monday, October 24, 2016

Voxxeddays Thesaloniki - a quick note #vdthes



Last Thursday & Friday, I did a short trip to Greece in order to attend the very first Voxxed Days in Greece, it took place in Thessaloniki

First of all, I would like to congratulate, the master mind behind the overall organization +Patroklos Papapetrou , who eventually succeeded and materialized a long lasting dream (for many of us), to establish in our small country, a  conference and activities that would bridge the gap between our small IT market with the rest of world or even the bigger European Markets and developer communities.

The 'Voxxed' family of conferences, is the ideal way for putting our country back in the map of IT conferences, and a great start to warm up again the local developer community.

So overall for me, the most important thing, is not if this particular first attempt was successful  (which was). The real important thing is (Athens or Thessaloniki) Voxxed Days,  to continue to exist next year and the year after, so that the local community can grow on them and vice versa! So we all need to support this initiative. The price was more than fair and I want to make a call to all the developers (and their companies) in Athens, in a few months time, to support the Athens Voxxed days.

So I am really excited we are going to have an Athens Voxxed Days, which I'm planning to attend and already thinking maybe submitting a talk as well.

During the conference I had the chance to talk with lots of  'blog' friends. Developers and subscribers of my blog. Thank you guys, I promise to keep the blog live and maybe make a new attempt on the podcast.

I was very happy to meet some old friends and talk about the latest state of the Greek IT market, like Spyros Anastasopoulos (one of the founding members of JHUG). You can read his thoughts and review about the conference here. I wish we had more IT professionals like Spyros, both technically but in terms of professional ethics. 

Eventually my trip was...very short, so I could not enjoy the beautiful city of Thessaloniki, maybe next time!

See you all in Voxxed Days Athens!