Search code examples
javaphptomcatjsprit

jsprit as backend for php web application


I might be barking up the wrong tree here as I have no experience with java programming.

I came across jsprit a java based VRP solver which looks very impressive and I was wondering if it can be used in a php based web app.

I have installed tomcat and JavaBridge, I have downloaded the jsprit source and binaries.

Is it possible...

  1. to use the binaries directly by creating and deploying a .war file?

or

  1. use the .jar files via JavaBridge?

or would I need some kind of java web app to act as a wrapper?

I have seen an app on github which looks to be a wrapper but it doesn't look finished or still active.

Thanks for any help...


Solution

  • After further research I found the anser myself.

    I downloaded the JavaBridge template .war file and renamed it to jsprit.war.

    I then downloaded the binaries for jsprit.

    Using 7-zip I added the jsprit binaries to the newly renamed jsprit.war in the WEB-INF\lib folder.

    Installed and setup tomcat.

    Installed php5.cli.

    Using tomcat web app manager I deployed the jsprit.war file.

    Now, by including http://localhost:8080/JavaBridge/java/Java.inc in my php page I am now able to access the jsprit classes using: $location = new java('jsprit.core.problem.Location');

    Hope this helps someone else in the future.