Cannot find any VM in Java_Home – Mac

This is going to be a short one. so let’s get to it.

Today was one of those days you go past page 5 searching for an answer in Google. Hopefully you will not have to go through the same process I did to get a fix.

I have been working with daemons and i hit a snag. The VM/JVM not found snag.

I got the following error when running the daemon: “Cannot find any VM in Java Home /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
Cannot locate JVM library file”

After scrolling through the web I finally got a fix.


Open terminal and type the following commands:

NB: Replace jdk1.7.0_71.jdk with your jdk version.

$ cd /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents
$ sudo ln -s Home/jre/lib Libraries
$ cd Libraries
$ sudo ln -s server/libjvm.dylib libserver.dylib

That’s it. Problem solved 🙂

Let me get back to what I love doing, saving the world.

Swipe To Refresh Layout – Android

In the latest revision of the android support library came out with an interesting new layout SwipeRefreshLayout which implements the famous pull-down-to-refresh pattern. In the following tutorial I will show you how to implement it with a ListView and avoid some pitfalls.


To use this new layout you will need to have at least the android support library with at least revision 19.1.

First we need to import the support library project to our workspace and then add it to your main project as a library.


Let’s Write Some Code

First we need to create a layout XML file:

Next step is to add some java code in your Activity or Fragment.

We are almost there, just a few more lines of code.
If you try to refresh, your will be able to see the animation and your list would be updated. However, if scroll down in your list and try to go up again the swipe to refresh would be triggered again and you won’t be able to go back to the top of your list. This is annoying. You don’t want an angry user. Here is a fix for that.

We force the layout to refresh only when the very first item of the list is fully visible. To do this we assign an OnScrollListener to our ListView after the initialization of our swipe to refresh layout.

Now you are ready.

Go forth and master the art of Swiping. 😀