i am trying to execute .java file through php. please any one help.

.java is a source code file so you can't execute it. Yo have to compile it first
Compiled java programs that can be executed come in .class files or .jar files

If you have a .class file, eg myprog.class, then it's executed by javaw myprog
If you have a.jar file, eg myprog.jar, then it's javaw -jar myprog.jar
Full details are here: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html

I don't speak php, so I can't go any further, but if you know how to invoke an executable; (javaw.exe) with a parameter (myprog) then that's what you need.