开发者

Using Java Within PHP - Class Not Found

开发者 https://www.devze.com 2023-04-13 05:16 出处:网络
I\'m using Tomcat and PHP5 with JavaBridge. I have bridged PHP and Java so I can screencap web pages within PHP. This was working on another server but after moving to a new server I can not get it wo

I'm using Tomcat and PHP5 with JavaBridge. I have bridged PHP and Java so I can screencap web pages within PHP. This was working on another server but after moving to a new server I can not get it working, so I'm reaching for straws here.

require_once("http://localhost:8080/JavaBridge/java/Java.inc");
java_autoload("/web/sites/madfrog/domain.com/cron/bin/html2image.jar");
$JavaHTML2Image = new Java("com.elance.proposal.html2image.client.MainBridge");

It should have loaded all of the project html2image.jar when the script _autoloaded it, however when you create the new Java object I get the error

Class Not Found: Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: CreateInstance faile开发者_运维问答d: new com.elance.proposal.html2image.client.MainBridge. Cause: java.lang.ClassNotFoundException: com.elance.proposal.html2image.client.MainBridge

I asked the guys over in Java and they said I needed to put the jar file in the lib so Java could find it, so I dumped it into Tomcat's webapps folder an into /usr/share/java. But that did nothing. With that said the PHP has a direct reference to it, so it should be loaded.

I'm at a lost after two days. any help is appreciated!


Which version of Tomcat do you use?

For Tomcat 6 or Tomcat 7 put the jar either in ${tomcat.home}/lib or in ${tomcat.home}/webapps/${your.war}/lib
While tomcat.home is your tomcat installation directory. And your.war is the name of your war file.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号