java从php设置类路径

I have this folder structure

C:\a\b.java
C:\a\b.class
C:\a\c.java
C:\a\c.class
C:\a\ftp.jar

From PHP, I used exec("java b"); This executed b.class file. That is fine. Now I should execute c.class file from PHP. In c.java, I have created an object for the class which is in ftp.jar. So I should set classpath for this. But I couldnt set classpath from PHP

But when I do it from cmd, all working fine. Please tell me how to set classpath from PHP?

This might work (provide explicit cp argument, I haven't tried though):

exec("java -cp  C:\a\d.jar c"); //if d.jar contains c.class

or

exec("java -cp  C:\a c"); //if d.jar doesn't contain c.class