because you want to check if java is enabled or not on the visitors browser (clientside) you should use Javaa Script and not PHP to perform this action.
Here a simple example:
<script type="text/javascript">
if(navigator.javaEnabled() == true){
alert("Java is enabled");
window.location.href = "somefile.suf";
}else{
alert("Java disabled or not installed");
}
</script>
you may delete the else clause and the alerts.
ali