jenv ftw!

December 16, 2015

At the recent OpenMRS Worldwide Summit #OMRS15, I was helping out with the Saptarshi’s introductory tutorial and realized that the OpenMRS Standalone requires Java 7, meaning that it fails to run on Java 8. Yikes! But my Mac runs Java 8. How do I get Java 7 on my laptop without making a mess of things?

jenv to the rescue! jenv provides an easy way to manage multiple Java versions. Not only can you easily switch between Java versions, but you can configure different folders to run specific versions of Java. So, for example, you can run Java 7 for the OpenMRS Standalone and run Java 8 everywhere else.

Step zero. Install Homebrew. I already had this installed. I used to use Macports to install utilities on my Mac, but it was fairly invasive. Homebrew installs most everything under your user account, so it doesn’t mess with Mac’s view of the world and rarely, if ever, requires the use of sudo.

Step one. Install jenv.

brew install jenv

Step two. Install Java 7.

Grab the latest version of Java 7 SDK from Oracle’s Java 7 archive. For me, this meant navigating to the  Java SE Development Kit 7u80 downloads, accepting the license agreement, and then downloading and installing from the dmg package for Mac OS X x64.

Step three. Tell jenv about Java 7.

jenv add /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/

If your version number differs, then your command may differ slightly. You can always navigate into /Library/Java/JavaVirtualMachines/ to find your installed version folders.

Done!

Now you can navigate into your OpenMRS Standalone folder, set the preferred Java version with a command like:

jenv local oracle64-1.7.0.80

and then execute the standalone with:

jenv exec java -jar openmrs-standalone.jar

Tab Stack for Safari

December 1, 2015

I recently decided to try switching from Chrome to Safari for a while… to see if it might buy me a little more battery life on my aging MacBook Pro. One of the immediate drawbacks I discovered was realizing how accustomed I had become to the Tab Stack extension for Chrome. It’s a simple workaround for MRU (most recently used) tab ordering that moves the active tab to the left after a brief delay (the delays lets you scan through tabs without re-ordering them). It’s a bit hacky and I’m sure a lot of people wouldn’t care for the approach, but I’m used to it and immediately noticed its absence in Safari.

I googled around and didn’t find an equivalent extension for Safari… so I made one and submitted it to Apple’s gallery. I’ve added an extra hack to mitigate Safari’s insistence on clearing the address bar when tabs are moved (move new tabs immediately) as a version 1.1.

iPad Pro

April 17, 2010

Own a MacBook Pro and an iPad?  Tired of carrying around both?  Meet the iPad Pro.

I’m looking forward to the day when the monitor of my MacBook Pro becomes an iPad.  No extra things to carry around.  If you want to run to a quick meeting or browse on the couch, just snap off your monitor and go (it’s an iPad).  Miss your keyboard, DVD drive, extra ports, extra battery life, etc.?  Just plug your iPad back onto the iPad Pro base and you’ve got a full laptop.  Keep a cloth in your bag to wipe off those fingerprints and stop freaking out when people touch your monitor — it’s a multitouch monitor, after all.

Creating a Desktop Shortcut on a Mac

November 26, 2008

Making a desktop shortcut icon on the Mac is pretty easy.  Open up the AppleScript script editor and make a script like this:

do shell script “/Applications/Firefox.app/Contents/MacOS/firefox-bin -P Developer -no-remote &”

Then save as an application on the desktop.  Done.

This example shows how to pass parameters from AppleScript.  In particular, it shows how to open a 2nd Firefox window with the “Developer” profile by passing some command line parameters from AppleScript.