Coming Up for Air

From OS X to Linux

Jason Lee 2012-04-23

/images/2012/04/mac.jpg

When I joined Sun Microsystems "way back" in 2008, I was asked if I wanted a Mac for my work system. Having heard many extol the numerous virtues of the OS, I jumped at the chance. Since then, I've even migrated my wife and family to the OS. Trouble arose last fall, though, with the delivery of a new MacBook Pro (whose purchase was somewhat a miracle, brought about by the tireless efforts from my upper management). Simply put, I got a lemon. After five trips to the Apple Store, which resulted in overnight diagnostic runs; shipment to an offsite, more advanced repair facility; the replacement of the hard drive; and the replacement of the motherboard, I finally broke down and asked for a new machine, knowing it wouldn't be a Mac. Just over a week ago, a new Lenovo Thinkpad arrived, and, after putting Linux on it, I have to say I'm generally very happy with the system.more

In general, Apple puts together a very nice system in the MacBook Pro. The machine is a physical beauty, and the OS is veyr polished and user-friendly. As a developer, though, there were somethings that bothered me. The lack of any real visibility (that I could find) into the packaging system, the use of plists over conventional Unix configuration files, the odd command-line parameter parsing in the shell, the nearly universal requirement to use the mouse, the odd keyboard layout, etc. had been grating on me. Now I'l grant that many of these are silly or easily resolved, but they were different enough from years of habit-building that I never could get completely used to them, nor could I find workarounds that I really cared for.

From a user experience, my complaints realy boil down to personal preferences. Many will likely read this list and think I'm quite a crank for my age, and that's fine. We all have different preferences (I recently read a blurb about a Haskell developer -- I forget his name -- who prefers Windows!. Now that's crazy, right? ;). At the end of the day, I had some minor quibbles with the OS, but I sucked it up and pressed on, and was generally pretty productive. Much more than I was on the Windows laptop at my last gig.

/images/2012/04/cof_orange_hex.jpg

Enter Linux. Or, I should say, re-enter Linux. I've been using Linux for many, many years now, so many of the annoyances I found when using OS X were the result of forming habits in that other Unix-like OS. On this new machine, I installed Linux Mint, which seems to the flavor of the day in some circles, and was mostly pleased. I had some odd issues with menus in NetBeans that seem to be GNOME-related, so I tried LXDE, which I found to be a bit...ugly, and finally KDE, with which I had some stability issues. Over the course of part of an afternoon, then, I installed Ubuntu 12.04, since I had read that they fixed all the woes that at first plagued Unity. Surprisingly, I'm pretty happy with Unity. It has its issues, but the system is fast and stable, and lets me work the way I prefer, which is all I really wanted.

Given my experience with this latest system, I doubt I'll return to OS X in the near future. For me, Linux on the desktop is just about right. The price certainly is.

Java 7, NetBeans, Mac OS X, and a Little Bit of JavaFX 2

Jason Lee 2012-04-09

In a recent post showing how to use JavaFX 2 and NetBeans on the Mac, I noted that I have been unable to run NetBeans using Java 7 on my Mac for reasons I had not been able to figure out. Now, thanks to a pointer from Scott Kovatch , the technical lead at Oracle for the Mac OS X port of Java, I think I can show you how to do that.

Getting Started with JavaFX on the Mac

Jason Lee 2012-04-05

image::/images/2012/04/javafxlogocolor_1-300x150.jpg

As you may have guessed from my recent book review , I've been tinkering with JavaFX some, as time as permitted. I've been following the technology fairly closely since Sun announced the project way back in 2008. When it was announced that JavaFX 2.0 was finally available, albeit in preview form, for the Mac, I was ecstatic. I ran into issues, though, trying to get it to run in my IDE , though. After some guess work and googling, I finally figured it out. In retrospect, it may be obvious, but if you're like me and are missing the obvious, I'm going to detail the steps I took to get it running on my Mac. Perhaps it can help someone out.more

The first step, of course, is to download the binaries. You can do that here , sort of. Since this is still a preview release at the time of this writing, you have click the teeny tiny link under the header. Once you've downloaded the distribution, you need to extract it somewhere:

$ unzip javafx_sdk-2_1_0-beta-b19-macosx-universal-27_mar_2012.zip -d $HOME/local/

You can, of course, put it anywhere you want, but you'll need to adjust the following instructions. The next step is set up NetBeans. NetBeans has JavaFX support out of the box, assuming your JDK has JavaFX support. Since the Mac JDK does not yet, we need fix that. Otherwise, you'll see this error:

/images/2012/04/newprojectbad-300x224.png

To fix this, we need to create a Java Platform with JavaFX support (I don't know why we can't modify the default platform, but we can't, so we get to create a new one, which we can set to be the default if we want). To do that, go to Tools > Java Platforms, where you should see something like this:

/images/2012/04/javaplatforms.png

To create a new Java Platform, click the (wait for it...!) "Add Platform..." button in the lower left corner. OS X likes to put things in decidedly (to me) un-Unixy locations, and the JDK is no different. You can find the current JDK under /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents:

/images/2012/04/selectjdk-300x185.png

We now need to give it a name, so we'll call this "JDK 1.6 with JavaFX" and click OK. But wait, there's no JavaFX support! To enable JavaFX support, we have to...um..enable it. Doing so looks like this:

/images/2012/04/addjavafxsupport-300x185.png

We can now create a new JavaFX project:

/images/2012/04/newprojectgood.png

Your new project is ready to run.

The even more adventurous may be wondering how one would do this with Java 7, to which I say, "Good question!" Adam Bien , but I haven't had a chance to debug things (e.g., the navigation tree under projects has all the tree icons, but no text. IIRC, the context menus are also text-less. Strange).

At any rate, as I noted earlier, in retrospect, this seems pretty easy (if a bit unintuitive) and might be documented somewhere, but I couldn't find it. Either way, it's certainly documented now. I hope it helps. : )

Book Review: Pro JavaFX 2: A Definitive Guide to Rich Clients with Java Technology

I was privileged to be given a copy of the recently released Pro JavaFX 2: A Definitive Guide to Rich Clients with Java Technology http://www.assoc-amazon.com/e/ir?t=coupfoai0f-20&l=as2&o=1&a=1430268727 from Apress, authored by James Weaver , Weiqi Gao , Stephen Chin , Dean Iverson , Johan Vos . This review is a bit overdue, but I hope you find it as helpful as I found the book.

GlassFish 3.1.2, REST Security, and the Jersey Client

Jason Lee 2012-03-12

I recently blogged about a change we made in GlassFish 3.1.2 with regard to REST security. Specifically, we added some CSRF protection (you can read the details here ). For those of you using the Jersey Client, updating your code to support this change is very simple:

import com.sun.jersey.api.client.filter.CsrfProtectionFilter;
// ...
Client client = new Client();
client.addFilter(new CsrfProtectionFilter());
// ...

On the client side, that's all you have to change. Jersey will take care of the details.

Hat tip to Dan Allen for suggesting this post. :)

Search

Quotes

Sample quote

Quote source

About

My name is Jason Lee. I am a software developer living in the middle of Oklahoma. I’ve been a professional developer since 1997, using a variety of languages, including Java, Javascript, PHP, Python, Delphi, and even a bit of C#. I currently work for Red Hat on the WildFly/EAP team, where, among other things, I maintain integrations for some MicroProfile specs, OpenTelemetry, Micrometer, Jakarta Faces, and Bean Validation. (Full resume here. LinkedIn profile)

I am the president of the Oklahoma City JUG, and an occasional speaker at the JUG and a variety of technical conferences.

On the personal side, I’m active in my church, and enjoy bass guitar, running, fishing, and a variety of martial arts. I’m also married to a beautiful woman, and have two boys, who, thankfully, look like their mother.

My Links

Publications