It is a security issue.
In real word environment (not IDE debugging) your code runs inside the browser on the client machine
AND TRY TO READS THE REGISTRY OF THE CLIENT!!!. However, browser security prevents from you to do so.
In any case I believe you missing here some point. Web applications by it's nature are parted to server-client... Means part of your code runs on the server and an other part on the client.
The part you presented here belongs to the client.
As I understand you want to check the installed Java version of the client. For that Oracle gives you JavaScript to do so...
Start here
http://docs.oracle.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#deplToolkit[
^]
A sample to display installed versions
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="http://java.com/js/deployJava.js"></script>
<title>JRE Versions</title>
</head>
<body>
<div id="idJREs">
</div>
<script type="text/javascript">
function getJREs() {
document.getElementById('idJREs').innerText = deployJava.getJREs();
}
window.onload = getJREs;
</script>
</body>
</html>