In 2014, it’s not OK if it’s hard for a developer to run a simple program from the command line.
I wrote some code to connect Keybase and OpenKeychain, and plan to write more. Since it’s in an Android app the code was in Java and it occurred to me that since (so they say) other people use Java too, those people might be able to use it, so I’m working on that. But it shouldn’t be so hard.
I had the Java code already working and in production, so I copied it out of OpenKeychain and made a new project and wanted a smoke test which I thought I ought to be able to run from the command line.
Only I couldn’t. First of all, it took me forever to figure out the java command-line incantations to tell it that it needed my project’s class files and the json.org library (which I’d already downloaded so I could compile the sucker). Yeah, I used to know that stuff ten years ago, but there really shouldn’t be any complexity here.
After I’d figured it out, it refused to run because I wanted to, you know,
https:// URL, but no, Java 7 won’t do that because,
well, I don’t actually know, there’s some incomprehensible botch in some certs
table. This is Java 7 out of the box, OS X out of the box, everything out of
the box, and it doesn’t work; apparently you can fix it with
low-level system security rejiggering, but I just want to fetch a fucking
and I shouldn’t have rejigger anything. By the way, curl can fetch that same
URL just fine from the command line, the one that Java can’t.
So the easier solution was to create a stub Android project called KeybaseTest with an empty TextView into which I could do the moral equivalent of:
printf("%d %s", https_status, https_message_body);
Of course, to try this out, I had to plug an actual physical Android device into my physical Mac that should have been able to run this simple straightforward code, then use adb incantations to debug. Remember, this is the easy way to run Java code.
So for the moment, my Keybase Java client is structured as an Android project because near as I can tell, in 2014 that’s the only straightforward way to run a Java program that wants to use the Internet on a device that I own.