I’m working with an application which requires Trang to convert RELAX NG schema files. Trang itself is quite old code and this seems to present problems on newer distributions - all sorts of problems getting it to run under GCJ in particular.
While there are probably speed advantages in going the GCJ route, I’m more interested in just getting it working - the schema files only need converting once so speed isn’t really an issue here.
I cheated and just used the JDK and a shell script wrapper. If you just need it to work too, here’s how I did it.
Install JDK
This is obviously different for every platform, but in this case it’s on Ubuntu and is as simple as:
sudo aptitude install sun-java5-jdk
Fetch Trang
You need the original Java zip file, not the GCJ version.
From this you need to extract the jar file:
Install Trang
I placed mine in /usr/local/trang but it doesn’t really matter where it goes.
sudo cp trang.jar /usr/local/trang
Create a wrapper shell script
The shell script just invokes java on the Trang jar file with the supplied arguments. Create the file /usr/local/bin/trang in your favourite editor:
/usr/lib/jvm/java-1.5.0-sun/bin/java -jar /usr/local/trang/trang.jar $@
And then make the script executable:
Test it
Assuming the script is in your PATH, you should now be able to use it as normal (albeit slowly - the startup time hurts a bit!)