2

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...

Gavin
  • 2,123
  • 1
  • 15
  • 19

1 Answers1

4

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.

Gavin
  • 2,123
  • 1
  • 15
  • 19
  • 1
    Hi @Gavin Thanks for sharing your solution. I am in the same situation and I need to make jscript work with PHP either through API or any other way which is possible. I read your solution but I don't completely understand as I am not familiar with Java. Could you please explain how that will work and if it does everything jsprit does? Do I need to know java to use your solution? How do I call functions like optimizing multiple waypoints etc? If you could share your solutions with me that would be much appreciated. – Mo Baqeri Sep 27 '19 at 14:04