Hello I have a java jar files and a batch file that I want to run using the java -cp command and from PHP.
My jar files are inside a folder called "jars" in my server and I'm doing as following to run them :
//java.php
$result = exec('java -cp "pack1.jar:pack2.jar" pack3.connect.CommandLine -rb batchfile.odlbat');
echo $result;
This command is working in PHP when all my jar and batch file are in the same folder as my javacall.php file.
Now I want to copy my jar and batch files to a new folder "parent" so I tried to modify the script to load the jar and batch files from the "parent" folder but I get this error :
//java.php
$result = exec('java -cp "parent/pack1.jar:parent/pack2.jar" parent/pack3.connect.CommandLine -rb parent/batchfile.odlbat');
echo $result;
Error : Could not find or load main class parent.pack3.connect.CommandLine
Any help please?
Thanks
If you check the documentation for the classpath: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html
I think that you must use instead:
You just need to update the classpath and not the package page path of your main class
CommandLine
Change this
to