What to do when you get an UnsatisifiedLinkError when running an SWT or JFace application

So you’re trying to run an SWT application (or JFace, since JFace relies on SWT) inside Eclipse and you get the dreaded UnsatisfiedLinkError. This usually appears as one of the following: Exception in thread “main” java.lang.UnsatisfiedLinkError: no swt-pi-carbon-3063 in java.library.path (Carbon on Mac OS X), Exception in thread “main” java.lang.UnsatisfiedLinkError: no swt-win32-3063 in java.library.path (Win32 on Windows), or Exception in thread “main” java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3063 in java.library.path (GTK2 on Linux). Those are the UnsatisifiedLinkErrors for SWT in Eclipse 3.0.1.
For Eclipse 3.0, it would be swt-pi-carbon-3062, swt-win32-3062, and swt-pi-gtk3062 respectively.

Now there is an easy correction for this. Just go to “Run” | “Run…”, which brings up the “Run” dialog. Then navigate to the “Arguments” tab and in the “VM Arguments:” text box, enter (for Eclipse 3.0.1):

-Djava.library.path=${system:ECLIPSE_HOME}/plugins/org.eclipse.swt.carbon_3.0.1/os/macosx/ppc (for Carbon on Mac OS X)

-Djava.library.path=${system:ECLIPSE_HOME}/plugins/org.eclipse.swt.win32_3.0.1/os/win32/x86 (for Win32 on Windows) or

-Djava.library.path=${system:ECLIPSE_HOME}/plugins/org.eclipse.swt.gtk_3.0.1/os/linux/x86 (for GTK2 on Linux).

For Eclipse 3.0, substitute 3.0.0 wherever you see 3.0.1.

Things I wish I knew when I first started using SWT on Windows

SWT on Windows was probably the “killer app” or “killer feature” of Eclipse. When Eclipse 1.0 came out, it looked great on Windows, was fast, and was indistinguishable from any other Windows app. Before that, you could always tell that a Java/Swing app was somehow different, as if you could hear the song “one of these things is not like the others”. Swing has gotten better and faster, especially with the Windows XP Look and Feel, but SWT upgraded to XP quicker and is still more native and faster.

The Windows SWT implementation also has some unique features vs other Operating Systems (OS in SWT terminology) due to the SWT team taking advantage of the features of Win32, which is the Windows System (WS in SWT terminology) of Windows. It’s kind of ironic, that the Java community was in a huge uproar over Microsoft’s WFC (Windows Foundation Classes), which did the same thing, that is, have Windows-specific extensions. The difference it seems is that WFC was made by Microsoft and SWT is made by the independent non-profit Eclipse Foundation. Note that the architect of WFC was another one of my favorite gurus, Anders Hejlsberg, who was also the architect of the almost-VB-killer Delphi. He has more recently gone on to create C# and .NET. It’s a small, strange world, eh?

Continue reading “Things I wish I knew when I first started using SWT on Windows”

Things I wish I knew when I first started using SWT on a Mac

I’ve got a friend who I persuaded to try Eclipse and is just learning how to use it. So it got me thinking: what would I have wanted someone to tell me when I first started programming with Eclipse? Today, I’ll focus on running SWT apps on a Mac. Why pick that? Well, because creating “Hello World” in Eclipse on any platform is very simple.

SWT on the other hand, presents an interesting initial hurdle, but is straightforward after that first bump. The reason why is because, unlike Swing, SWT relies on native libraries to achieve a native, fast, and responsive look and feel on each platform.

Continue reading “Things I wish I knew when I first started using SWT on a Mac”

How to run Eclipse from the command line in OS X (and Windows and Linux)

EclipseosxiconThe Mac is very easy to use due to its innovative packaging system for applications, where it hides an entire tree of directories inside one file/icon. With Eclipse, this shows up as the Eclipse icon that we know and love.

However, if you’re a hardcore programmer, then you really should get your hands dirty with the command line via OS X’s Terminal. This lets you get down to the UNIX core. When you go into your Eclipse install directory, you’ll find a nice executable named appropriately enough: “eclipse”. Well, it’s actually just a symbolic link into the Eclipse.app (the nicely packaged Eclipse application that I mentioned above.)

If you just type “eclipse”, you’re in for a rude awakening, as you won’t be able to interact with the UI and you’ll be forced to Control-C. The reason why is due to an obscure implementation of how threading works in the Apple Java Runtime and how it interacts badly with SWT’s (and thus Eclipse’s) expectation of how it should be running.

The solution, however is simple:

./eclipse -vm Eclipse.app/Contents/MacOS/java_swt

Continue reading “How to run Eclipse from the command line in OS X (and Windows and Linux)”

Why your car stereo needs a joystick

I think that user experience is important for software, but also for hardware. Think about it: the more you interact with something, either it becomes more invisible to you (and thus becomes “easy to use”) or the more its poor design either bugs you (and you eventually learn to live with it or replace it with something better.)

Shown here is the best interface I’ve seen for selecting which speakers your car stereo should play through. Stereojoystick
Continue reading “Why your car stereo needs a joystick”

Whatever happened to Cloudscape? (or what is Derby?)

Have you ever used Cloudscape? It’s a relational database that is written in Java. It’s been in development since 1996. One of the nice features is that it can be embedded in Java programs. I’ll write more about the benefits of embedding in another post. Another nice goodie is that it has a relatively small footprint (2 MB). For a comparison, MySQL 4.0.18 on my PowerBook takes up 146MB.

Ideally, I’d like to have an embeddable, object database written in Java, so write me if you find one. I’ve tried Prevayler. For some reason, I think I’d like a bit more community and API to work with.

You don’t have that problem with Cloudscape, as it uses SQL as its API, and thus you get the nice built-in to J2SE JDBC APIs. Also it is likely to have a big community behind it, as you’ll read below. Another nice thing is that apparently it also has a “network server”, meaning that you can run it standalone and connect to it remotely with JDBC.

So why do we care about Cloudscape anyways?
Continue reading “Whatever happened to Cloudscape? (or what is Derby?)”

Unofficial Guide to Eclipse 3.1 (Part 3)

Tonight, I’ll wrap up my look into the plans for Eclipse 3.1.

I had planned at going sub-project by sub-project for all the sub-projects in the Eclipse Technology Project. However, I realized that this project is partly incubator for projects, much like the Apache Incubator. It is also partly Academic Research and Educational projects, most of which don’t have specific project plans. Complicating my mission further, most of the projects don’t have specific future plans in the Eclipse 3.1 timeframe. So I broadened out my search to all the other top-level projects. Here’s what I found out…
Continue reading “Unofficial Guide to Eclipse 3.1 (Part 3)”

Unofficial Guide to Eclipse 3.1 (Part 2)

Today I continue looking at the plans for Eclipse 3.1 by looking at the Eclipse Tools project. I consider most of these “things that should probably be in Eclipse when you download it, but aren’t yet.” Since these are essentially independent projects, just grouped under the Tools umbrella, I’ll comment a bit about what each does, where they are now, and where they’ll likely be when Eclipse 3.1 gets released.
Continue reading “Unofficial Guide to Eclipse 3.1 (Part 2)”

Unofficial Guide to Eclipse 3.1 (Part 1)

My Eclipse cap
I’m a big believer in looking and planning ahead. So, since I depend on Eclipse as an IDE and as an application development platform, I thought it would be wise to find out what is in Eclipse 3.1.
(At the time of this writing, the most current version is Eclipse 3.0.1.)

So, I googled “eclipse 3.1” and a few results down, I found the main Eclipse Project 3.1 Draft Plan. Read this first.
Continue reading “Unofficial Guide to Eclipse 3.1 (Part 1)”