./java: No such file or directory (on Linux)

… and when you look, it exists, it has the correct permissions and everything. Do a long-listing and it’s readable and executable by everyone, and all the directories up the tree also are.  It just doesn’t start!  I spent a while looking for this and didn’t find it on google so hopefully this helps someone.

The clues:

$ file java
java: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), stripped

$ uname -a

reports a 64-bit OS.

The problem is you’re running a 64-bit OS with insufficient 32-bit shared library support to run a 32-bit binary.

The solution:

$ sudo aptitude install ia32-libs

(Courtesy of http://www.debian-administration.org/articles/534)

PS: Yes, I know I could get a 64-bit java interpreter….