JNI and Cygwin

Brian Duff
Brian’s Ancient Blog Posts
2 min readJan 12, 2020

This is an ancient blog post originally published by Brian Duff on 27 September 2003 on Radio Weblogs, and rescued from the Wayback Machine.

From time to time, I have to resort to writing native code to get highly Windows-specific things to work in Java. A good example is support for Visual SourceSafe in JDeveloper, which I’ve been working on as a “background task” since what feels like the beginning of time. It’s turning out to be a pretty gnarly chunk of C code (possibly the most C I’ve written… ever) that uses OLE to talk to SourceSafe, with a nice friendly Java API over the top.

Mostly, I’ve used Visual Studio.NET to do JNI development. Today, I was trying to fix something for WinLAF using JNI, and since I don’t have a copy of VS.NET at home, was hunting around for alternatives. Found this pretty neat guide to using Cygwin for JNI development on Windows — though mostly I just needed to know which arguments to pass into gcc — From this guide, I got that, it works, can now do JNI stuff without waiting about 24 hours for the VS.NET installer to complete. Yay :)

A discussion about flashing Windows taskbar icons in Java on the JavaDesktop.org forums also led me to the (beautifully designed) JNIWrapper website. It looks like a pretty useful utility (even if it is a bit too commercial for WinLAF). Having done integration between Java and an OLE API the “hard” way, I can now truly see the benefit of this kind of utility :)

Modern notes from future Brian:

It’s hard for me to believe in 2019 that I used to do all my development on Windows :)

The SourceSafe integration for JDeveloper was one of the more irksome projects that I worked on due to its complete lack of a documented API (we’d eventually signed some agreement with Microsoft to get some level of documentation, but it was still pretty lacking). At this point in my life I was still living the UK, working at Oracle’s UK HQ in Reading. Our UK-based team was primarily responsible for UML modeling and version control features in JDeveloper, so far from being a “background task” as I alluded to here, this was probably supposed to be one of my main projects.

On the other hand, all of the many, many side-projects I was doing on JDeveloper that had nothing to do with UML or version control are probably why I wound up here in Silicon Valley, which with the benefit of many years of hindsight was a good move.

Funnily enough, just the other day I wrote a quick JNI hack on Linux and Mac OS, and used Bazel. No funging around with gcc options! It was a piece of cake. Things have come a long way :)

--

--