Quick Tip: missing tools.jar fix

I am developing several applications in Java and I happen to be using a Mac. I have been for years and I just enjoy the OS. Java has never been an easy beast to deal with on a Mac and there are some scripts ( my main project being Compiere development ) that check for the tools.jar file. Compiere, for instance, checks for that file as a way to indicate the environment has the JDK not just the runtime installed. Anyway I just upgraded to Mountain Lion and with that, Java has to be reinstalled ( even if its been installed previously ). The fixes I made went away so I had to look in the Compiere forums for my solution. Here is what I do:

  • Open a terminal session
  • go to the java lib directory (cd $JAVA_HOME/lib)
  • create a file called tools.txt (sudo vi tools.txt)
  • once in this text file, write some text explaining the reason for this file so you remember why you did this.
  • exit out the editor of choice (vi in this case)
  • jar the file (sudo jar cvd tools.jar tools.txt)

This seems to work because, according to the Apple docs, classes.jar contains all the functionality that tools.jar contains so as long as the tools.jar file “exists” the JDK functionality should be fine.