ProGuard, Mac OS X, runtime libraries and honey

ProGuard is a great tool for packaging your Java Applet or application. We use it mainly to package a program and bunch of dependencies into small .jar file. It works great on Linux and Windows but on my Mac it would end up with messages like:

[proguard] Reading library jar [/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/jsse.jar]
[proguard] Error: Can't read [proguard.ClassPathEntry@50502819] (No such file or directory)

With some help  from the Eric Lafortune, the ProGuard author, the solution was to put a link to the missing file to its “regular” place in Java libraries:

cd $JAVA_HOME/lib
sudo ln -s ../../Classes/classes.jar rt.jar
sudo ln -s ../../Classes/jsse.jar .

The downside is that you should do some manual stuff on each Mac you want to build on. If somebody has better solution I would love to know about it.

In military training long time ago, I and my fellow students were forced to do a lot of things that were illogical, redundant or  outright stupid. Sometimes our only explanation was “so the life wouldn’t seem sweet like honey”. It kind of made sense to make life intentionally hard in the army — it was supposed to be training after all. It seems that the Apple in this case was following the same logic: let’s spread runtime libraries all over the system so that the engineer’s life wouldn’t seem too sweet like honey. Anybody got better explanation, please let me know.

About these ads