If you're referring to Sun Java, rather than the MS virtual-machine version, I ran into exactly the same error messages the first time avast (admittedly a few versions back) encountered Sun Java for the first time after I installed the latter.
The Sun Java is notorious for not downloading properly, which is why you'll see warnings all over their site to check file sizes both after downloading and after installing.
I un-installed the Java and re-downloaded and re-installed a couple of times, and of course have tried to ensure my avast is up to date (both program and database). No problems with scans in quite a while, so I assume I finally got a good clean download of Java, and/or more recent avast updates handle its archives better.