Problem was, at work I need to use HermesJMS which needs JAVA_HOME to be the 64 bit version (doesn't make sense, but it works). What to do? Fortunately, HermesJMS uses a batch file for its invocation, so just add
JAVA_HOME=C:\Progra~2\Java\jdk1.6.0_16to line 23 (or anywhere in the beginning, really). Done.