I have a few observations:
1) jre1.6.0_04 is not a JDK, it is a JRE.
2) When installing a JDK, don't install it in Program Files - spaces in the path can confuse various Java libraries. (You can install a JRE in "Program Files", just don't set JAVA_HOME to it.)
3) Don't use JDK 6u4 - it has too many issues. If you absolutely need to use JDK 6, use the latest version.
4) JBoss AS 4.0.what? There are vast differences between 4.0.0, 4.0.1, ... 4.0.5. So saying 4.0 does not help to identify what you are running.
5) JBoss AS 4.0.x (any version) is not qualified to run with JDK 6 - you should be using JDK 5.