More info
Turns out that the javaclasspath.txt isn't read in if MATLAB starts in a different folder to that of userpath. I get the same behaviour by double-clicking on a MAT file in some other folder on my system. When MATLAB starts it always runs startup.m in my userpath, it adds my userpath onto the MATLAB path and it can locate javaclasspath.txt using the which command, although it does not set javaclasspath using this file.....