Not a particularly interesting post, unless you happen to be running Debian 4.0 etch running on Virtuozzo host and are trying to install JDK5. I saw a post with a user reporting the same error on the parallels forum , but couldn’t find a clear solution, until I bumped onto a weird forum in German, which luckily linked to a related bug report (in English).
So if you get this error message when installing jdk5:
Setting up sun-java5-bin (1.5.0-14-1etch1) ...
Could not create the Java virtual machine.
dpkg: error processing sun-java5-bin (--configure):
subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)
The solution is to edit the postinst script
# vi /var/lib/dpkg/info/sun-java5-bin.postinst
comment out one line below:
# activate class data sharing
case i386 in i386|sparc)
rm -f $basedir/jre/lib/i386/client/classes.jsa
### $basedir/bin/java -client -Xshare:dump > /dev/null
Then reinstall. Ugly, but it seems to do the trick