I’ve really let someone down. This blog’s been up for all of a week, now, and someone’s already been here looking for java-readline mac os x.
And of course I didn’t have this entry written just yet…
The process isn’t really all that hard, but it is non-obvious. Someone should probably contribute this tidbit back to the source...
For starters, you’ll need to get DarwinPorts up and running if you haven’t already done so. Once that’s done, just do a
port install readline. You should know your DarwinPorts install root once you’ve installed it; in my case it’s
Compilation of java-readline is pretty straightforward at this point, but you do need to patch both
Makefiles in the source distribution to account for the non-Linux and non-Win32 options you’ll need for the linker.
These changes apply to java-readline version 0.8.0. In the source root, edit
Makefile and make the following changes:
JAVA_HOME = /Library/Java/Home
below the line
# Operating system dependent
- Make the
src/native/Makefile and change the following:
-I/opt/local/includeto the end of the
- Change the
LIBPATHvariable to be
- Change the
<del>fno</del>common(that should read “dash fno dash common”; stupid markdown.)
$(CC) -shared $(OBJECTS) $(LIBPATH) $($(TG)_LIBS) -o $@
$(CC) -bundle -flat_namespace -undefined suppress $(OBJECTS) $(LIBPATH) $($(TG)_LIBS) -o $@
You should now be able to run
make and get
libreadline-java.jar. You’ll need to rename
libJavaReadline.jnilib. I put both of these in
~/Library/Java/Extensions, which makes the library available to all Java processes that are started as you. Make sure everything works by running
java test.ReadlineTest from the command line.