You should just be able to insert it into the script. Thats what I do with my PHP files on my website. To test it out, make a PHP page (a sample PHP website page, with a few words and links and such) and then add a Java from a place like
http://www.dynamicdrive.com or
http://www.javascriptkit.com (make sure that the script says that it has been tested and will work in the browser you are trying to use) and test it out.Also, it will not work if your server blocks either PHP or Java.Good luck!