I’ve just installed Tomcat (for running Java) on my Godaddy virtual dedicated server.

There is a good set of instructions at Reliable Penguin. Note that the more up-to-date packages are available, so take a look on the web to get the version numbers first.

There were a couple of extra steps I needed to do.

1. autoconf

Install autoconf, which wasn’t on the server.

2. Getting java to work on the virtual server

Java didn’t want to play. Running java or javac was causing ‘Out of memory’ errors. This is due to the way memory management works on the virtual shared server.

The trick is to rename the executables and to create scripts in their place:

java

$JAVA_HOME/bin/java.exe -Xms64M -Xmx512M $1 $2 $3 $4 $5 $6 $7 $8 $9

javac

$JAVA_HOME/bin/javac.exe -J-mx512m $1 $2 $3 $4 $5 $6 $7 $8 $9

It would be nice if there was an environment variable (such as JAVA_FLAGS) you could set to do this. Thankfully, this approach seems to work.

(Tip: You can do a similar thing on Windows by renaming notepad.exe and creating a notepad.bat that loads the editor of your choice — such as Vim. Then, when you do a View, Source in IE you get your editor instead of Notepad.)