Search code examples
phplaravellaravel-5.3php-java-bridge

How to require Java.inc in laravel


I configure Java bridge with tomcat. Which is accessible in http://localhost:8080/JavaBridge/java/Java.inc.

In core php we use require_once to include file. require_once("http://localhost:8080/JavaBridge/java/Java.inc"); $myObj = new Java("com.fss.plugin.iPayPipe");

It works fine in core PHP. But it is not work in Laravel.

It shows an error Class 'Java' not found.

Please Help


Solution

  • Have a look at what is displayed when you open http://localhost:8080/JavaBridge/java/Java.inc in a browser - is it PHP code? If yes, try to output the result on your webserver through echo file_get_contents("http://localhost:8080/JavaBridge/java/Java.inc"); - is that still PHP code?

    Maybe there is an import you are missing - if the Java class is not in a namespace, but your Lavarel code is, you should instantiate the class using $myObj = new \Java(...)