2

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?

2
  • That's a Nice one. Review stackoverflow.com/questions/945962/… Commented Apr 24, 2013 at 7:34
  • actually i don't Know anything in PhP , but as a java , what happen if you add this jar file to java classpath?? Commented Apr 24, 2013 at 7:38

1 Answer 1

0

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.